2
0
forked from Wavyzz/dolibarr
Commit Graph

245 Commits

Author SHA1 Message Date
MDW
97099b854f Qual: Fix phan notices (install) 2025-02-05 01:43:41 +01:00
Laurent Destailleur (aka Eldy)
f0ae6b999f Debug v21 2025-01-03 15:55:05 +01:00
MDW
ec2a1928ba Qual: Update fields phpdoc to include fields that are defined/used in some cases
# Qual: Update fields phpdoc to include fields that are defined/used in some cases

comment, copytoclipboard, autofocusoncreated are documented and used in some cases for the
$fields definition
2024-12-05 02:36:50 +01:00
Laurent Destailleur
bd170e0474 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2024-11-12 11:33:31 +01:00
Frédéric FRANCE
1adc883b56 add baseline exclude for phpstan (#31632)
* add baseline exclude for phpstan

* update

* update

* update

* update

* update

* merge

* restore one filter

* delete old errors

* fix

* fix

* fix

* $moreforfilter can t be empty

* fix

* enable check

* refresh baseline

* add phpdoc

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* update phpstan baseline

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-11-04 23:53:20 +01:00
MDW
b91c99b18a Qual: Fix phan/phpstan notices in class files (part 3) (#31578)
* fix phpstan in conf class (#31630)

* fix phpstan

* fix phan

* Fix merge

* Qual: Avoid notification with typing hint

* Qual: Fix notices link.class

* Qual: Fix notices link..socialneetworkmanager.class and DoliDb->DoliDB

* Qual: Fix notices for link..utils.class

* Qual: Fix notices for db classes

* Update translate.class.php

* Update translate.class.php

---------

Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: Laurent Destailleur <eldy@users.sourceforge.net>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-10-29 22:44:47 +01:00
Laurent Destailleur
e6f1d4835f Clean sql code 2024-10-29 02:58:20 +01:00
Laurent Destailleur
4db9323706 Fix phan 2024-10-20 00:03:46 +02:00
Laurent Destailleur
c70973c0c8 Merge v20 2024-10-19 14:44:55 +02:00
Laurent Destailleur
c9ed9bb6eb FIX Avoid fatal error when mysqli not available 2024-10-18 23:48:24 +02:00
Laurent Destailleur
471668b940 FIX Toolt to convert utf8mb4 2024-09-30 23:12:01 +02:00
Laurent Destailleur
4a3d081dca FIX Toolt to convert utf8mb4 2024-09-30 23:11:31 +02:00
MDW
42bb4fbf3e Qual: Enable & fix or ignore Invalid DimOffset (#31176)
* Qual: Enable & fix or ignore Invalid DimOffset

# Qual: Enable & fix or ignore Invalid DimOffset

The Invalid DimOffset notices occur when array keys are defined and
the index used is not amongst the known array keys.

This PR enables these notices and fixes array definitions when needed,
or ignores the notices locally if it's a false positive, or in the
baseline.txt when it does not seem to be a false positive so that
it can be fixed later

* Nullable object typing in function signature not ok for 7.0/8.4

Can't user '?User' as argument type for PHP7.0 which is required by PHP8.4.
Therefore, removing the typing specification in the function definition

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-29 21:52:31 +02:00
Laurent Destailleur
3bf7bab967 Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop 2024-09-12 02:21:46 +02:00
Laurent Destailleur
a52963020d Doc 2024-09-12 02:21:14 +02:00
Laurent Destailleur
b1ee18864f Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop 2024-09-12 01:43:43 +02:00
Laurent Destailleur
cbf3cbfa1f Better debug log 2024-09-12 01:33:58 +02:00
MDW
ca414de526 Qual: Fix $fields related notices with Phan (#30704)
* Qual: Typing hints/ignore directives for phan notices

* Update field typing
2024-08-21 13:23:35 +02:00
MDW
54880f92cd Qual: Fix PhanTypeMismatchProperty and some other phan notices (#30542)
* Qual: Fix PhanTypeMismatchProperty and some other phan notices

* Qual: Phan fixes for BOM

* Phan - fix fields

* fixup! Qual: Phan fixes for BOM

* Fix phpstan double array keys for syslog

* Fix $fields phpdoc

* Fix phan typing issues with intermediate var and ??

* Fix phan typing issue with ?? operator

* Ignore htdocs/install/install.forced.php for git

* Qual: Revert to original code, ignore notice

When changing the method to avoid one notice type, another one
appears.  So simply ignoring this error.

* Qual: Revert to original code, ignore notice

When changing the method to avoid one notice type, another one
appears.  So simply ignoring this error.

* Update baseline

* Qual: Phan fixes for BOM

* fixup! Qual: Phan fixes for BOM

* Fix phpstan double array keys for syslog

* Qual: Revert to original code, ignore notice

When changing the method to avoid one notice type, another one
appears.  So simply ignoring this error.

* Ignore PhanTypeSuspiciousNonTraversableForeach to allow integration

* Fix typing hints (phpstan)

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-15 17:05:00 +02:00
Charlène Benke
1a3dddb3cc FIX sanitize must allow space on attribute (#30566)
sanitize must allow space on attribute

otherwhise  "on update CURRENT_TIMESTAMP" for tms fields goes wrong
2024-08-11 00:02:05 +02:00
Charlène Benke
0a2d4bee75 FIX sanitize must allow space on attribute (#30490)
* sanitize must allow space on attribute

otherwhise  "on update CURRENT_TIMESTAMP" for tms fields goes wrong

* Update mysqli.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-07-31 15:41:00 +02:00
Laurent Destailleur
6358f89c0d Fix phan warnings 2024-04-28 17:10:51 +02:00
MDW
bc5e5b67af Qual: Update phan baseline (#29300)
* Qual: Update phan baseline

* Init variable to ensure it is defined

* Init $module_part to ensure it is defined

* Init $modulepart to ensure it is defined

* phpdoc typing for getNetNeeds and getNetNeedsTree

* Enforce type for phan

* Initialise  $massactionbutton so that it is defined

* phpdoc: improve typing

* Encore character_set value is string (for typing)

* fixup! Qual: Update phan baseline

* Fix duplicate code

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-04-12 01:06:52 +02:00
Laurent Destailleur
c87f24e3f4 Fix mysqli 2024-03-29 17:09:36 +01:00
Laurent Destailleur
ce274c403e Depreciate a method usage 2024-03-23 19:06:54 +01:00
Laurent Destailleur
7290ffd1ab Better support for postgesql 2024-03-21 15:57:45 +01:00
Laurent Destailleur
a6d5b32c2e Merge branch 'develop' into qual/db/typing 2024-03-21 14:13:58 +01:00
Laurent Destailleur
2d0e57ce7c Fix test for pgsql 2024-03-21 14:13:17 +01:00
Laurent Destailleur
8ab80490e6 Merge branch 'develop' into qual/db/typing 2024-03-21 13:57:13 +01:00
Laurent Destailleur
477fb7a035 Fix warning 2024-03-21 13:55:23 +01:00
Laurent Destailleur
0d6675114e Merge branch 'develop' into qual/db/typing 2024-03-21 13:19:51 +01:00
Laurent Destailleur
380c1092eb Fix warnings 2024-03-21 13:19:31 +01:00
Laurent Destailleur
e97f0a7668 Merge branch 'develop' into qual/db/typing 2024-03-21 13:06:35 +01:00
Laurent Destailleur
aee4ccc32c Fix warnings 2024-03-21 13:06:20 +01:00
Laurent Destailleur
9d5aa4a448 Fix sanitization 2024-03-21 13:02:41 +01:00
Laurent Destailleur
04d8a20b63 Merge branch 'develop' into qual/db/typing 2024-03-21 12:46:25 +01:00
Laurent Destailleur
aa77573cd9 Sanitize DDL instructions 2024-03-21 12:45:58 +01:00
Laurent Destailleur
171c32be34 Add DDLDropTable and DDLCreateTable into phpunit tests 2024-03-21 12:21:38 +01:00
Laurent Destailleur
ce2959b022 Clean method DDLCreateTable (used by modulebuilder only) #28996 2024-03-21 12:10:09 +01:00
Laurent Destailleur
27c0192b7c cast smallint 2024-03-21 11:17:15 +01:00
MDW
fc6af20479 Update typing for database functions 2024-03-21 00:00:00 +01:00
Laurent Destailleur
06ae1deb1b Fix better error message when using bad character_set_client 2024-03-18 17:27:06 +01:00
MDW
dbfb1180ee Qual: Fix PhanPluginDuplicateIfStatements & remove exceptions (#28749)
# Qual: Fix PhanPluginDuplicateIfStatements & remove exceptions

Fix occurences of PhanPluginDuplicateIfStatements which are if statements where the
consecutive branches execute the same code, making it useles to test the condition
2024-03-11 12:58:51 +01:00
MDW
6d9e7b8144 Qual: Fix PhanTypeMismatchArgumentInternalProbablyReal (#28732)
* Fix: False positive for PhanTypeMismatchArgumentInternalProbablyReal

* Qual: phan: suppress false positive on ssl_set

* Qual: Enable PhanTypeMismatchArgumentInternalProbablyReal

# Qual: Enable PhanTypeMismatchArgumentInternalProbablyReal

PhanTypeMismatchArgumentInternalProbablyReal are fixed and reporting can
be enabled.

* Qual: Fix PhanTypeMismatchArgumentInternalProbablyReal by improving typing

* Qual: Rewrite/optimize to fix PhanTypeMismatchArgumentInternalProbablyReal

# Qual: Rewrite/optimize to fix PhanTypeMismatchArgumentInternalProbablyReal

False positive detecting that  is not an int, rewriting to check
impact
2024-03-10 01:55:56 +01:00
thibdrev
cc5366249a qual: phpdoc for htdocs/core/db/mysqli.class.php (#28703)
PHPDoc update to reflect what the code does today.

This update however doesn't solve this PHPStan warning:
htdocs/core/db/mysqli.class.php	243	Return type (mysqli|null) of method DoliDBMysqli::connect() should be compatible with return type (resource) of method Database::connect()
2024-03-08 12:10:09 +01:00
MDW
eb1f6be1e2 Qual: Add information from backtrace when mysql request fails. (#28583)
# Qual: Add information from backtrace when mysql request fails.

This helps locate the line that was responsible for the SQL request
2024-03-02 19:57:59 +01:00
MDW
8655d5a86b QUAL Use phan to help detect new issues (#27706)
* Qual: Add phan flow

- Add phan configuration (config, baseline, stubs);
- Add github action;
- Update apstats.php.

* Add directives to ignore false phan notices

* Qual: Add typing hints for extrafields TPL files

# Qual: Add typing hints for extrafields TPL files

Add typing hints for phan on view files

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-02-21 18:14:29 +01:00
Frédéric France
03e29c6960 fix param 2024-01-20 09:22:38 +01:00
MDW
b4b0cdf105 Fix: Deprecated mysqli::init() in PHP8.1
# Fix: Deprecated mysqli::init() in PHP8.1

See https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.mysqli
2024-01-18 22:04:19 +01:00
MDW
89004f7e03 Qual: Spelling htdocs/core (#27491)
Highlights:
- initialY in pdf_standard.modules.php was unused
  - remove (otherwise -> initially) (+same in other file)
2024-01-13 19:48:20 +01:00