Commit Graph

2403 Commits

Author SHA1 Message Date
MDW
8a9f86e109
Qual: Suppress PhanTypeSuspiciousNonTraversableForeach (#31382)
# Qual: Ignore PhanTypeSuspiciousNonTraversableForeach

PhanTypeSuspiciousNonTraversableForeach reports on the use of
`foreach ($object as $key => value)` which is valid accross
tested php versions (at least since PHP7.0).

So suppressing this notice.
2024-10-17 01:54:19 +02:00
MDW
9677a370e9
Qual: Nullable mysoc hint (#31393)
* Qual: Nullable mysoc hint

# Qual: Nullable mysoc hint

$mysoc can be nullable resulting in issues (#31387) so
it is best to detect these cases with static analysis

* Prevent null assignment
2024-10-17 01:44:54 +02:00
MDW
cad13e85e3
Qual: Fix smtps.class (#31403)
# Qual: Fix smtps.class

Fix most phan notices in smtps.class
2024-10-15 15:49:41 +02:00
MDW
0524358377
Qual: Fix phan notices in dolgraph class (#31399)
# Qual: Fix phan notices in dolgraph class

This fixes most notices in the dolgraph class.
2024-10-15 15:46:19 +02:00
MDW
53cfbc35be
Qual: Fix several phan & stan notices (#31308)
* Qual: Fix several phan & stan notices

# Qual: Fix several phan & stan notices

Several fixes in files while fixing UnknownClass notices

* Qual: Update prepare_head PHPDoc return types

# Qual: Update prepare_head PHPDoc return types

Provide detailed array return types for prepare_head functions.

* Fix new phan notice

* Better loadLangs typing and fix call to loadLangs

* Fix new issues (stats)

* Other fixes of new issues

* Qual: update phan baseline
2024-10-14 01:59:44 +02:00
MDW
8609df383a
Qual: fix phan notices (#31368)
* Qual: fix phan notices

# Qual: fix phan notices

Fix phan/phpstan notices, mostly in html,formmail

* Ignore phpstan exception
2024-10-14 00:36:42 +02:00
Laurent Destailleur
a255e9b5c8 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2024-10-13 20:58:40 +02:00
MDW
523d472962
ci: Automatically determine version for upgrade sequence (#31344)
* ci: Automatically determine version for upgrade sequence

This automatically determines the version for the upgrade process
to help avoid editing the scripot on version upgrades.

* Include filefunc.inc.php to md5sum, remove old som computation
2024-10-13 17:29:56 +02:00
MDW
d7b2f95baf
Qual: Fix phan notices (#31372)
* fix llx_webhook_target-webhook.sql

* Fix commande/list & facture-rec.class

* Fix bonprelevement

* Qual: Fix prelevement/create notices

* Qual: fix quadridetail notices & update baseline

* Qual: Fix CommonDocGenerator notices

* Qual: Fix commoninvoice and commonobjectline notices (phan/phpstan)

---------

Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
2024-10-13 16:45:42 +02:00
MDW
c9690393bc
Fix undefined global varialbe user/card.php (#31353)
# Fix undefined global varialbe user/card.php

Fix a few issues, one of which noticed in V21 UI.

Also notified by phan:
```
htdocs\user\card.php:626 PhanUndeclaredGlobalVariable Global variable $mesgs is undeclared
htdocs\user\card.php:2967 PhanUndeclaredGlobalVariable Global variable $soc is undeclared

```
2024-10-11 16:05:37 +02:00
MDW
9c20e93860
Fix: Cope with undevined country key in search array. (#31354)
# Fix: Cope with undefined country key in search array

Fix:
```
htdocs\partnership\partnership_list.php:533 PhanUndeclaredProperty Reference to undeclared property \Partnership->login
htdocs\partnership\partnership_list.php:793 PhanTypeMismatchArgumentProbablyReal Argument 4 ($filter) is null of type null but \FormAdmin::select_language() takes array|string[] (no real type) defined at htdocs\core\class\html.formadmin.class.php:74 (the inferred real argument type has nothing in common with the parameter's phpdoc type)
```
2024-10-11 16:04:46 +02:00
MDW
bde0f0d794
Qual: Fix ci (phpstan notice) (#31301)
# Qual: Fix ci (phpstan notice)

While fixing the ci notice, also fixed the array definitions
which fixes both phan notices and phpstan notices seen on cti.
Removed the exception for phan on this file
2024-10-07 15:44:06 +02:00
MDW
f4c91d5bb6
Qual: Fix phan/phpstan notices (#31297)
# Qual: Fix phan/phpstan notices

Fix several phan and phpstan notices.
2024-10-07 14:07:24 +02:00
MDW
0c26110636
Qual: Fix notices related to user classes (#31291)
# Qual: Fix notices related to user classes

This fixes several notices related to user classes (and reveals
some actual bugs or inconsistent typing).
2024-10-06 13:52:05 +02:00
MDW
34e3717dda
Qual: Fix phan/phpstan notices (#31289)
* Qual: Fix phan/phpstan notices

# Qual: Fix phan/phpstan notices

Fix several phan/phpstan notices

* Fix spelling in Changelog
2024-10-06 13:03:43 +02:00
MDW
f70c945931
Qual: Fix phan/stan notices (#31271)
Some checks are pending
CI / pre-commit (push) Waiting to run
CI / phan (push) Blocked by required conditions
CI / phpstan (push) Blocked by required conditions
CI / windows-ci (push) Blocked by required conditions
CI / gh-travis (push) Waiting to run
# Qual: Fix phan/stan notices in relation with UnknownObjectMethodCall

Fix notices in classes with UnknownObjectMethodCall notices or classes
related with these.
2024-10-05 18:55:36 +02:00
Laurent Destailleur
965558e309 Clean trans
Some checks are pending
CI / pre-commit (push) Waiting to run
CI / phan (push) Blocked by required conditions
CI / phpstan (push) Blocked by required conditions
CI / windows-ci (push) Blocked by required conditions
CI / gh-travis (push) Waiting to run
2024-10-04 19:30:34 +02:00
Frédéric FRANCE
8305c35b6b
fix phpdoc (#31262)
* fix phpdoc

* fix phpdoc
2024-10-04 09:40:05 +02:00
MDW
1834c37c16
Qual: Fix phan notices (#31212)
* Qual: Fix phan notices

# Qual: Fix phan notices

Fix several phan notices related to classes with UnknownObject
classes.

* Qual: Fix phan notices

* Qual: Fix phan notices

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-10-03 19:40:34 +02:00
MDW
2d0b1de36f
Qual: Add codespell entries to catch some css typos (#31222)
# Qual: Add codespell entries to catch some css typos

Added some codespell entries based on the observed typos in css
tags
2024-10-03 19:36:59 +02:00
Frédéric FRANCE
7d36fe0715
fix typo phan and Co 💊 (#31214)
* fix typo

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* translation missing

* test win mariadb version

* test win mariadb version

* phpdoc

* phpdoc

* phpdoc
2024-10-03 15:43:04 +02:00
Frédéric FRANCE
44fdcdd8ed
can set position of file with dol_move (#31201)
* can set position of file with dol_move

* Update api_documents.class.php

* Update api_documents.class.php

* fix

* fix

* fix

* fix

* fix
2024-09-30 16:49:38 +02:00
MDW
8236aed22f
Qual: Fix phan notices (#31193)
# Qual: Fix phan notices

Fix phan notices in several classes that have UnknownObjectMethod calls and classes
that had notices in relation with these classes
2024-09-30 10:05:24 +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
MDW
93005b2c08
Qual: Add centpecent to codespell, fix css (#31178)
# Qual: Add centpecent to codespell, fix css

Try to prevent misspelling in css by adding centpecent.
Fix corresponding cases

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-29 13:09:09 +02:00
MDW
0da4d51003
Qual: Fix multiple phan notifications (#31151)
* Qual: Fix notifications multiple files

# Qual: Fix notifications multiple files

Fixes to files with UnknownObject notices, fixing other
notices in these files as well

* Improve boxes typing

* Qual: Extend accepted types to reduce notices

* Fix type for GET/POST arguments of GETPOST* calls
2024-09-28 12:09:35 +02:00
MDW
c62e015410
Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl (#31087)
# Qual: Fix (propal|facture|contrat|fichinter)/card, commonobject, files.lib/card_presend.tpl

Fix phan notices in these files

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-26 23:01:02 +02:00
MDW
ec07381f2c
Qual: More specific ignoreErrors for phpstan (#31113)
* Qual: More specific ignoreErrors for phpstan

# Qual: More specific ignoreErrors for phpstan

More specific ignore expressions helps identify new exceptions that
would have matched the more generic ignore expressions.

It also helps to progressively solve phpstan notices
in smaller steps by modifying the expressions

* CamelCase for dictFieldList

* Update phan baseline
2024-09-26 17:42:40 +02:00
MDW
158de3d54a
Qual: Fix Plugin ParamMatchRegexPlugin when classname is variable (#30970)
# Qual: Fix Plugin ParamMatchRegexPlugin when classname is variable

Fix a case where the plugin throws an undefined variable because the
classname in the php source is variable
2024-09-23 03:36:17 +02:00
MDW
5e02bec9df
Qual: Fix getTooltipContentArray typing hints (#31081)
* Qual: Fix getTooltipContentArray typing hints

# Qual: Fix getTooltipContentArray typing hints

This defines the aray type for all getTooltipContentArray occurences

* Ignore undeclared property ref_supplier (does not exist on OrderLine)
2024-09-23 03:24:19 +02:00
Frédéric FRANCE
000173c7b9
fix phpstan (#31075)
* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-23 01:59:14 +02:00
MDW
2bf3729f8a
Qual: Fix copyright fixer (#31072)
* Qual: Fix copyright fixer

# Qual: Fix copyright fixer

Enable actual file write, disable debug message

* Fix: ci/missing global $conf in chargessociales
2024-09-23 01:30:21 +02:00
MDW
7b4c4d772c
Qual: Fix notices for FormSms, RssParser, ExpenseReportIk and related (#31086)
* Qual: Fix Array of tabs typing hints

# Qual: Fix Array of tabs typing hints

Fixed same typing hints accross several files

* Qual: Fix pdf.lib.php, project.lib.php and related files

# Qual: Fix pdf.lib.php, project.lib.php and related files

Fix most phan notices for pdf.lib.php and project.lib.php.
And fixed some items in other files in the process

* Qual: Fix notifications commande/card advtarget.tpl fichinter/card societe/card supplier_proposal/card

* Qual: Fix notices for FormSms, RssParser, ExpenseReportIk and related

# Qual: Fix notices for FormSms, RssParser, ExpenseReportIk and related

Fix notices in the files for the classes above and other files to accomodate
these changes/fixes
2024-09-23 00:37:30 +02:00
Laurent Destailleur
c8a1ac578d Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2024-09-20 16:09:24 +02:00
Laurent Destailleur
bc9746891d NEW Can change the type of a social contribution if no payment 2024-09-20 16:09:06 +02:00
MDW
6fb924e90b
Qual: Update baseline for phan (because of fixes) (#31008)
# Qual: Update baseline for phan (because of fixes)

Several fixes to the code (mostly related to phpstan notices) also
fixed several phan notices which are removed from the baseline
with this change.
2024-09-20 02:19:52 +02:00
MDW
4c7bcaa980
Qual: Fix argument mismatch for form_attach_new_file (#31014)
# Qual: Fix argument mismatch for form_attach_new_file

Use null instead of '' to match the argument type for form_attach_new_file.
2024-09-20 02:14:31 +02:00
MDW
0d33f502bd
Qual: Fix server_other phan notices (#31017)
# Qual: Fix server_other phan notices

Improve typing to fix notices, ignore UndeclaredProperty.
2024-09-20 02:13:05 +02:00
MDW
4189be78ae
Qual: Update copyright alignment (#31027)
# Qual: Update copyright alignment

One can observe that copyright statements already generated are manually
aligned to the shorter statements in the file.

32 characters (or 8 tabs) was considered the maximum width for the
name column in the entire codebase and used to generate the new
copyright notices.
However, this is often shortend.

This update makes the fixcopyrightheader.php check the copyright notices
already present in the file and adapt the new notice to those
2024-09-20 00:33:30 +02:00
Frédéric FRANCE
3976525aef
add missing translations (#31037)
Some checks are pending
CI / pre-commit (push) Waiting to run
CI / phan (push) Blocked by required conditions
CI / phpstan (push) Blocked by required conditions
CI / windows-ci (push) Blocked by required conditions
CI / gh-travis (push) Waiting to run
* add missing translations

* add missing translations
2024-09-19 21:07:50 +02:00
MDW
099dbd9c1e
Qual: Fix notices for htdocs/admin/* (#30982)
Some checks are pending
CI / pre-commit (push) Waiting to run
CI / phan (push) Blocked by required conditions
CI / phpstan (push) Blocked by required conditions
CI / windows-ci (push) Blocked by required conditions
CI / gh-travis (push) Waiting to run
* Fix (Possibly)UndeclaredGlobalVariable

* Update phan baseline

* Fix (Possibly)UndeclaredGlobalVariable (2)

* Qual: Fix notices for htdocs/admin/*

# Qual: Fix notices for htdocs/admin/*

Fixes most phan/phpstan noticies for files under htdocs/admin/* and ai.
2024-09-18 03:27:25 +02:00
MDW
9a9e851494
Qual: Fix new UndeclaredGlobalVariable notices & enable (#30963)
* Qual: 🛟 Fix typing

Qual: Fix typing

Fix some typing currently failing ci in develop.

* Fix typing for grabimages

* Qual: Fix new UndeclaredGlobalVariable notices & enable

# Qual: Fix new UndeclaredGlobalVariable notices & enable

This fixes several new notices regarding 'undeclared globals' which
mostly correspond to missing initialisations in views and some real
bugs where the variable name was incorrect.
Some less obvious cases are unsolved and ignored (adherents/list,
and fourn/commande/card).

This is in preparation of fixing the notices in the other files
where the baseline was already set to ignore them where most just
need a phan-var-force declaration which will help with verifying
type compatibity and object member verifications
2024-09-16 01:50:58 +02:00
MDW
115627a054
Qual: Fix PhanPluginUnknownObjectMethodCall where is the only phan notice (#30957)
* Qual: PhanPluginUnknownObjectMethodCall where it is the only phan notice

# Qual: PhanPluginUnknownObjectMethodCall where it is the only phan notice

Fix PhanPluginUnknownObjectMethodCall in files where it is the only phan notice

* Update phan baseline

* Fix $website global type in some contexts
2024-09-16 01:49:38 +02:00
MDW
f89245b354
Qual: Fix some CommonIncoterm/DocGenerator/People typings (#30940)
* Fix extraparams property typing

* Fix argument typing

* Fix 'status' argument type in calls to dolGetButtonTitle

* Fix argument2 for price to 1 (was 2)

* Fix deliveryreceipt argument

* Fix PHPDoc dol_sort_array

* Fix range for int argument

* Fix arg type for str_pad and add some PHPDoc

* Fix natsort value for dol_sort_array

* Fix arguments on calls to dol_sort_array

* Reduce phpstan exceptions

* Qual: Add type hints for Stripe objects

# Qual: Add type hints for Stripe objects

Suggest the more specific implementation of the StripObject.

* Typing, initialisation

* Qual: Fix undeclared variables

* Update phan baseline

* Update baseline

* Qual: Add type hints for Stripe objects

# Qual: Add type hints for Stripe objects

Suggest the more specific implementation of the StripObject.

* Add PHPDoc for host class properties

* Ignore false positive (phan) for deprecated property

* Improve typing

* Update baseline
2024-09-13 03:09:23 +02:00
MDW
76eaf8bd8d
Qual: Fix phan notices in classes related to class using getNextValue. (#30925)
* FIX 🛟 phan

* getToolTip() can take null for $coc

* Fix uninitialized vars & arg types

* PHPDoc typing, argument fixes

* PHPDoc typing, argument fixes for AdherentType

* PHPDoc typing, argument fixes for AdherentStats

* Update baseline to enable adherent notices

* Fix PHPDoc typing in api_members

* Minor bug fixes, typing

* PHPDoc api_subscriptions

* PHPDoc Societe

* Ignore empty foreach notice

* Add initialiser

* Categorie is string, old int mode is deprecated

* Fix missing initialisations

* Fix missing initialisations adherents/note

* Fix typing (cast), initialisation of var

* Fix initialisations

* Fix argument types

* Improve array PHPDoc type

* PHPDoc array type

* PHPDoc: Improve typing

* Correct argument type to getNomUrl

* Improve typing for timespent

* Fix typing for getNextValue args

* Improve typing

* Fix typing hints contrat/card

* Update baseline

* Fix typing

* Fix extraparams property typing

* Fix argument typing

* Qual: Correct covariant type

* Impove typing for timespent

* Remove exclusion no longer matched (level 6)

---------

Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
2024-09-12 21:16:42 +02:00
MDW
812ac85b20
Qual: Improvements to actions_massactions.inc.php (#30805)
* Qual: Fix phan notices in actions_massactions.inc

# Qual: Fix phan notices in actions_massactions.inc

This fixes up the notices in htdocs/core/actions_massactions.inc.php

Separated from #30733.

* Adjust baseline for actions_massactions.inc improvements

* Update actions_massactions.inc.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-10 03:07:57 +02:00
MDW
506454b10a
Qual: Resolve ~200 phan notices/~100 phpstan notices (#30879)
* bookkeeping\card.php, productaccount

* Fix bookkeeping/listbyaccount

* Typing for accountancycategory

* Fix typing accountancyimport

* Typing accountingaccount

* Typing api_accountancy

* bookkeeping typing

* Fix typing lettering

* Typing for accountancy/customer/list

* Typing accountancy/journal/bankjournal

* typing accountancy/journal/variousjournal

* Typing accountancy/supplier/list

* Initialisations in accountancy/journal/expensereportsjournal

* Initialisations in accountancy/journal/purchasesjournal

* Initialisations in accountancy/journal/sellsjournal

* Update baseline
2024-09-10 02:11:53 +02:00
MDW
32732d37d2
Qual: Improve typing in Export class (#30859)
* Update baseline

* Qual: Improve typing in Export class

* Add 'abstract' methods to help with typing

* Add some typing

* Improve typing in export modules

* Improve typing for AccountancyExport

* Qual: PHPDoc executeCLI (nullable arguments, range)

* PHPDoc for export function

* Fix $permissiontoClose -> $permissiontoclose

* PHPDoc - Improve AccountingJournal typing

* Improve export_journal tpl typing

* Improve html.formsetup typing

* Impove commonfieldsexport typing

* Improve extrafieldsinexport typing

* Fix typing, initialisation

* Fix typing intracommreport

* Ensure string in $error for CronJob
2024-09-09 03:15:26 +02:00
MDW
97a9e2b3b0
Fix: deprecations in repair.php & Qual: Improve ... phpunit/setup_conf.sh (#30825)
* Qual: Add force_install_createuser to setup script

* Qual: Improve dev/setup/phpunit/setup_conf.sh

# Qual: Improve dev/setup/phpunit/setup_conf.sh

- Use variables for credentials instead of repeating hardcoded values;
- Add variables to configuration parameters;
- Add prefix to tables;
- Execute repair.php.

* Fix deprecated calls to explode(<string>, null)

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-05 15:51:15 +02:00
MDW
c496e84916
Qual: Fix phan issues related to getNextValue() notices (#30747)
* Qual: 🛟 Fix reference to $db with $this->db

# Qual: reference to $db with $this->db

$db was undeclared, use $this->db.

* Fix suspected issue with environment max size and md5sum working on limited files

* Qual: Fix LDAP typing

* Qual: Fix some phan typing related to getNextValue()

# Qual: Fix some phan typing related to getNextValue()

This fixes a few typings in relation to getNextValue().

* Update phan baseline

* PHPDoc: set arguments as nullable (+update array types)

* Improve PHPDoc

* Force toselect type to int[]

* Enable all phan notices on actions_massactions.inc.php

* Test was wrong, can not count when it's not an array

* Update baseline

* Remove ignore for notice that no longer exists

* Update baseline

* Fix format argument

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-08-29 15:01:42 +02:00