Skip to content

Commit

Permalink
Phpstan: Seprate phpstan baseline files by php version
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Apr 15, 2024
1 parent 4d5c50d commit 23067c3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
16 changes: 16 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$arr1 of function array_merge_recursive expects array, array\\|object\\|null given\\.$#"
count: 1
path: src/Form.php

-
message: "#^Parameter \\#3 \\$length of function substr expects int, int\\<1, max\\>\\|null given\\.$#"
count: 1
path: src/FormElement/LocalDateTimeElement.php

-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<ipl\\\\Html\\\\ValidHtml\\> given\\.$#"
count: 1
path: src/FormattedString.php
11 changes: 11 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge_recursive expects array, array\\|object\\|null given\\.$#"
count: 1
path: src/Form.php

-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<ipl\\\\Html\\\\ValidHtml\\> given\\.$#"
count: 1
path: src/FormattedString.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-8x.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
}

return [
'includes' => $includes
];
12 changes: 1 addition & 11 deletions phpstan-baseline.neon → phpstan-baseline-standard.neon
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,6 @@ parameters:
count: 1
path: src/Form.php

-
message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge_recursive expects array, array\\|object\\|null given\\.$#"
count: 1
path: src/Form.php

-
message: "#^Parameter \\#3 \\$postfix of method ipl\\\\Html\\\\Form\\:\\:addPluginLoader\\(\\) expects string, string\\|null given\\.$#"
count: 2
Expand Down Expand Up @@ -362,7 +357,7 @@ parameters:

-
message: "#^Cannot access offset 'name' on mixed\\.$#"
count: 2
count: 1
path: src/FormElement/BaseFormElement.php

-
Expand Down Expand Up @@ -590,11 +585,6 @@ parameters:
count: 1
path: src/FormattedString.php

-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<ipl\\\\Html\\\\ValidHtml\\> given\\.$#"
count: 1
path: src/FormattedString.php

-
message: "#^Property ipl\\\\Html\\\\FormattedString\\:\\:\\$args \\(array\\<ipl\\\\Html\\\\ValidHtml\\>\\) does not accept array\\<bool\\|float\\|int\\|ipl\\\\Html\\\\ValidHtml\\|string\\>\\.$#"
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 23067c3

Please sign in to comment.