From 343e05efc5da6c1dc6d45947e8e428c92c855ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 26 Sep 2025 20:46:46 +0200 Subject: [PATCH] update phpstan (#35487) --- .github/workflows/ci-phpstan_baseline.yml | 2 +- .github/workflows/phpstan.yml | 2 +- dev/build/phpstan/phpstan-baseline.neon | 94 +++++++++++------------ 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci-phpstan_baseline.yml b/.github/workflows/ci-phpstan_baseline.yml index 49a074555bb..a68414b62df 100644 --- a/.github/workflows/ci-phpstan_baseline.yml +++ b/.github/workflows/ci-phpstan_baseline.yml @@ -39,7 +39,7 @@ jobs: with: php-version: ${{ env.PHP_VERSION }} coverage: none # disable xdebug, pcov - tools: phpstan:2.1.8, cs2pr + tools: phpstan:2.1.12, cs2pr extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt env: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index e14dc22a288..9e473c10360 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -43,7 +43,7 @@ jobs: with: php-version: ${{ matrix.php-version }} coverage: none # disable xdebug, pcov - tools: phpstan:2.1.8, cs2pr + tools: phpstan:2.1.12, cs2pr extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index cabc2e0a370..5fadc91ba9a 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -1767,7 +1767,13 @@ parameters: - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType - count: 2 + count: 1 + path: ../../../htdocs/bookmarks/bookmarks.lib.php + + - + message: '#^Call to function is_array\(\) with non\-empty\-array\ will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 path: ../../../htdocs/bookmarks/bookmarks.lib.php - @@ -1951,14 +1957,14 @@ parameters: path: ../../../htdocs/comm/action/index.php - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse + message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#' + identifier: function.impossibleType count: 1 path: ../../../htdocs/comm/action/index.php - - message: '#^Right side of && is always true\.$#' - identifier: booleanAnd.rightAlwaysTrue + message: '#^If condition is always false\.$#' + identifier: if.alwaysFalse count: 1 path: ../../../htdocs/comm/action/index.php @@ -2106,6 +2112,12 @@ parameters: count: 1 path: ../../../htdocs/comm/action/pertype.php + - + message: '#^Call to function is_array\(\) with string will always evaluate to false\.$#' + identifier: function.impossibleType + count: 1 + path: ../../../htdocs/comm/action/peruser.php + - message: '#^Loose comparison using \!\= between ''show_peruser'' and ''show_day'' will always evaluate to true\.$#' identifier: notEqual.alwaysTrue @@ -3373,7 +3385,7 @@ parameters: path: ../../../htdocs/compta/localtax/list.php - - message: '#^Call to function is_array\(\) with list\\> will always evaluate to true\.$#' + message: '#^Call to function is_array\(\) with list\\> will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 path: ../../../htdocs/compta/localtax/quadri_detail.php @@ -6967,7 +6979,7 @@ parameters: path: ../../../htdocs/core/lib/admin.lib.php - - message: '#^Offset 1 on array\{string, non\-falsy\-string, string\} in empty\(\) always exists and is not falsy\.$#' + message: '#^Offset 1 on array\{non\-falsy\-string, non\-falsy\-string, string\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset count: 1 path: ../../../htdocs/core/lib/admin.lib.php @@ -7119,7 +7131,7 @@ parameters: - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue - count: 3 + count: 4 path: ../../../htdocs/core/lib/functions.lib.php - @@ -7153,19 +7165,19 @@ parameters: path: ../../../htdocs/core/lib/functions.lib.php - - message: '#^Offset ''list'' on array\{list\: array\{\}\}\|array\{list\: non\-empty\-array\\} in isset\(\) always exists and is not nullable\.$#' + message: '#^Offset ''list'' on array\{list\: array\{\}\}\|array\{list\: non\-empty\-list\\} in isset\(\) always exists and is not nullable\.$#' identifier: isset.offset count: 1 path: ../../../htdocs/core/lib/functions.lib.php - - message: '#^Offset 1 on array\{string, non\-falsy\-string\} in empty\(\) always exists and is not falsy\.$#' + message: '#^Offset 1 on array\{non\-falsy\-string, non\-falsy\-string\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset count: 1 path: ../../../htdocs/core/lib/functions.lib.php - - message: '#^Offset 1 on array\{string, non\-falsy\-string\} in isset\(\) always exists and is not nullable\.$#' + message: '#^Offset 1 on array\{non\-falsy\-string, non\-falsy\-string\} in isset\(\) always exists and is not nullable\.$#' identifier: isset.offset count: 1 path: ../../../htdocs/core/lib/functions.lib.php @@ -7404,6 +7416,12 @@ parameters: count: 1 path: ../../../htdocs/core/lib/xcal.lib.php + - + message: '#^Offset 0 on array\{non\-falsy\-string, non\-empty\-string\} in empty\(\) always exists and is not falsy\.$#' + identifier: empty.offset + count: 1 + path: ../../../htdocs/core/lib/xcal.lib.php + - message: '#^Loose comparison using \=\= between ''auto'' and ''auto'' will always evaluate to true\.$#' identifier: equal.alwaysTrue @@ -9504,12 +9522,6 @@ parameters: count: 1 path: ../../../htdocs/document.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/document.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -14112,30 +14124,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/massstockmove.php - - - message: '#^Variable \$datatoimport might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/massstockmove.php - - - - message: '#^Variable \$endatlinenb might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/massstockmove.php - - - - message: '#^Variable \$excludefirstline might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/massstockmove.php - - - - message: '#^Variable \$format might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/product/stock/massstockmove.php - - message: '#^Variable \$producttmp might not be defined\.$#' identifier: variable.undefined @@ -16200,12 +16188,6 @@ parameters: count: 1 path: ../../../htdocs/reception/list.php - - - message: '#^Variable \$dolibarr_main_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/recruitment/admin/public_interface.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -16632,6 +16614,24 @@ parameters: count: 1 path: ../../../htdocs/salaries/card.php + - + message: '#^Loose comparison using \=\= between '''' and ''nolink'' will always evaluate to false\.$#' + identifier: equal.alwaysFalse + count: 2 + path: ../../../htdocs/salaries/class/paymentsalary.class.php + + - + message: '#^Result of \|\| is always false\.$#' + identifier: booleanOr.alwaysFalse + count: 2 + path: ../../../htdocs/salaries/class/paymentsalary.class.php + + - + message: '#^Variable \$url in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 2 + path: ../../../htdocs/salaries/class/paymentsalary.class.php + - message: '#^Negated boolean expression is always false\.$#' identifier: booleanNot.alwaysFalse