From f0a06900c3004801361a50795af8461c5692fc5c Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 9 Apr 2024 11:41:14 +0200 Subject: [PATCH] Separate phpstan baselines by php version wip --- phpstan-baseline-7x.neon | 36 +++++++++++++++++++ phpstan-baseline-8x.neon | 21 +++++++++++ phpstan-baseline-by-php-version.php | 12 +++++++ ...ine.neon => phpstan-baseline-standard.neon | 20 ----------- phpstan.neon | 3 +- 5 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 phpstan-baseline-7x.neon create mode 100644 phpstan-baseline-8x.neon create mode 100644 phpstan-baseline-by-php-version.php rename phpstan-baseline.neon => phpstan-baseline-standard.neon (97%) diff --git a/phpstan-baseline-7x.neon b/phpstan-baseline-7x.neon new file mode 100644 index 0000000..7b87c66 --- /dev/null +++ b/phpstan-baseline-7x.neon @@ -0,0 +1,36 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$str of function urldecode expects string, mixed given\\.$#" + count: 1 + path: application/controllers/HostsController.php + + - + message: "#^Parameter \\#1 \\$str of function urldecode expects string, mixed given\\.$#" + count: 1 + path: application/controllers/ServicesController.php + + - + message: "#^Argument of an invalid type array\\\\|false supplied for foreach, only iterables are supported\\.$#" + count: 1 + path: library/Graphite/Util/MacroTemplate.php + + - + message: "#^Cannot access offset int on non\\-empty\\-array\\\\|false\\.$#" + count: 1 + path: library/Graphite/Util/MacroTemplate.php + + - + message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\\\|false given\\.$#" + count: 1 + path: library/Graphite/Util/MacroTemplate.php + + - + message: "#^Property Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate\\:\\:\\$template \\(array\\\\) does not accept array\\\\|false\\.$#" + count: 1 + path: library/Graphite/Util/MacroTemplate.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + count: 1 + path: library/Graphite/Web/Controller/MonitoringAwareController.php diff --git a/phpstan-baseline-8x.neon b/phpstan-baseline-8x.neon new file mode 100644 index 0000000..25b3ec3 --- /dev/null +++ b/phpstan-baseline-8x.neon @@ -0,0 +1,21 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$string of function urldecode expects string, mixed given\\.$#" + count: 1 + path: application/controllers/HostsController.php + + - + message: "#^Parameter \\#1 \\$string of function urldecode expects string, mixed given\\.$#" + count: 1 + path: application/controllers/ServicesController.php + + - + message: "#^Parameter \\#1 \\$separator of function explode expects non\\-empty\\-string, string given\\.$#" + count: 1 + path: library/Graphite/Util/MacroTemplate.php + + - + message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" + count: 1 + path: library/Graphite/Web/Controller/MonitoringAwareController.php diff --git a/phpstan-baseline-by-php-version.php b/phpstan-baseline-by-php-version.php new file mode 100644 index 0000000..05107df --- /dev/null +++ b/phpstan-baseline-by-php-version.php @@ -0,0 +1,12 @@ + $includes +]; diff --git a/phpstan-baseline.neon b/phpstan-baseline-standard.neon similarity index 97% rename from phpstan-baseline.neon rename to phpstan-baseline-standard.neon index 1923f08..8aed7c1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline-standard.neon @@ -80,11 +80,6 @@ parameters: count: 1 path: application/controllers/HostsController.php - - - message: "#^Parameter \\#1 \\$string of function urldecode expects string, mixed given\\.$#" - count: 1 - path: application/controllers/HostsController.php - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" count: 1 @@ -185,11 +180,6 @@ parameters: count: 1 path: application/controllers/ServicesController.php - - - message: "#^Parameter \\#1 \\$string of function urldecode expects string, mixed given\\.$#" - count: 1 - path: application/controllers/ServicesController.php - - message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#" count: 1 @@ -515,11 +505,6 @@ parameters: count: 1 path: library/Graphite/Util/InternalProcessTracker.php - - - message: "#^Parameter \\#1 \\$separator of function explode expects non\\-empty\\-string, string given\\.$#" - count: 1 - path: library/Graphite/Util/MacroTemplate.php - - message: "#^Cannot cast mixed to int\\.$#" count: 2 @@ -560,11 +545,6 @@ parameters: count: 1 path: library/Graphite/Web/Controller/MonitoringAwareController.php - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 1 - path: library/Graphite/Web/Controller/MonitoringAwareController.php - - message: "#^Parameter \\#1 \\$value of method Icinga\\\\Module\\\\Graphite\\\\Web\\\\Form\\\\Validator\\\\CustomErrorMessagesValidator\\:\\:validate\\(\\) expects string, mixed given\\.$#" count: 1 diff --git a/phpstan.neon b/phpstan.neon index c129242..86367a1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ includes: - - phpstan-baseline.neon + - phpstan-baseline-standard.neon + - phpstan-baseline-by-php-version.php parameters: level: max