Separate phpstan baselines by php version

This commit is contained in:
Sukhwinder Dhillon 2024-04-09 11:41:14 +02:00
parent 90e2be2348
commit f806671de3
5 changed files with 71 additions and 21 deletions

36
phpstan-baseline-7x.neon Normal file
View file

@ -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\\<int, string\\>\\|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\\<int, string\\>\\|false\\.$#"
count: 1
path: library/Graphite/Util/MacroTemplate.php
-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Graphite/Util/MacroTemplate.php
-
message: "#^Property Icinga\\\\Module\\\\Graphite\\\\Util\\\\MacroTemplate\\:\\:\\$template \\(array\\<string\\>\\) does not accept array\\<int, string\\>\\|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

21
phpstan-baseline-8x.neon Normal file
View file

@ -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

View file

@ -0,0 +1,12 @@
<?php
$includes = [];
if (PHP_VERSION_ID < 80000) {
$includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-8x.neon';
}
return [
'includes' => $includes
];

View file

@ -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

View file

@ -1,5 +1,6 @@
includes:
- phpstan-baseline.neon
- phpstan-baseline-standard.neon
- phpstan-baseline-by-php-version.php
parameters:
level: max