Skip to content

Commit

Permalink
Separate phpstan baselines by php version
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Apr 9, 2024
1 parent 90e2be2 commit f806671
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 21 deletions.
36 changes: 36 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions phpstan-baseline-by-php-version.php
Original file line number Diff line number Diff line change
@@ -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
];
20 changes: 0 additions & 20 deletions phpstan-baseline.neon → phpstan-baseline-standard.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
includes:
- phpstan-baseline.neon
- phpstan-baseline-standard.neon
- phpstan-baseline-by-php-version.php

parameters:
level: max
Expand Down

0 comments on commit f806671

Please sign in to comment.