Skip to content

Commit

Permalink
Update phpstan baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Feb 9, 2024
1 parent 7d33f04 commit 4a73bc6
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 67 deletions.
1 change: 1 addition & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
composer require -n --no-progress overtrue/phplint phpstan/phpstan
sudo git clone --depth 1 https://github.com/Icinga/icingaweb2.git /icingaweb2
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-library.git /usr/share/icinga-php/ipl
sudo git clone --depth 1 -b snapshot/nightly https://github.com/Icinga/icinga-php-thirdparty.git /usr/share/icinga-php/vendor
- name: PHP Lint
Expand Down
41 changes: 41 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: src/Compat/CompatController.php

-
message: "#^Parameter \\#3 \\$length of function substr expects int, int\\<0, max\\>\\|false given\\.$#"
count: 1
path: src/Control/SearchBar/Suggestions.php

-
message: "#^Parameter \\#1 \\$str of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Control/SearchBar/Terms.php

-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#2 \\$str of function explode expects string, int\\|string\\|null given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#1 \\$str of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Filter/Renderer.php

-
message: "#^Parameter \\#1 \\$stack of function array_push expects array, mixed given\\.$#"
count: 1
path: src/FormElement/TermInput.php

-
message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, string\\|false\\|null given\\.$#"
count: 1
path: src/Widget/Tabs.php
46 changes: 46 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int\\|string, mixed\\> given\\.$#"
count: 1
path: src/Compat/CompatController.php

-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\|false given\\.$#"
count: 1
path: src/Control/SearchBar/Suggestions.php

-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Control/SearchBar/Terms.php

-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, int\\|string\\|null given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#1 \\$column of method ipl\\\\Web\\\\Filter\\\\Parser\\:\\:createCondition\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: src/Filter/Parser.php

-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Filter/Renderer.php

-
message: "#^Parameter \\#1 \\$array of function array_push expects array, mixed given\\.$#"
count: 1
path: src/FormElement/TermInput.php

-
message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Widget/Tabs.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
];
72 changes: 6 additions & 66 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: src/Compat/CompatController.php

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

-
message: "#^Property ipl\\\\Web\\\\Compat\\\\CompatController\\:\\:\\$parts type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -100,11 +95,6 @@ parameters:
count: 1
path: src/Compat/Multipart.php

-
message: "#^Access to an undefined property Zend_View_Interface\\:\\:\\$document\\.$#"
count: 2
path: src/Compat/ViewRenderer.php

-
message: "#^Method ipl\\\\Web\\\\Compat\\\\ViewRenderer\\:\\:inject\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -167,19 +157,14 @@ parameters:

-
message: "#^Cannot access offset 'terms' on mixed\\.$#"
count: 2
count: 1
path: src/Control/SearchBar.php

-
message: "#^Cannot access offset 'type' on mixed\\.$#"
count: 2
path: src/Control/SearchBar.php

-
message: "#^Cannot access offset mixed on array\\|object\\.$#"
count: 1
path: src/Control/SearchBar.php

-
message: "#^Cannot call method getHeaderLine\\(\\) on Psr\\\\Http\\\\Message\\\\ServerRequestInterface\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -247,7 +232,7 @@ parameters:

-
message: "#^Cannot access offset 'column' on mixed\\.$#"
count: 3
count: 1
path: src/Control/SearchBar/Suggestions.php

-
Expand All @@ -257,7 +242,7 @@ parameters:

-
message: "#^Cannot access offset 'operator' on mixed\\.$#"
count: 2
count: 1
path: src/Control/SearchBar/Suggestions.php

-
Expand All @@ -267,12 +252,12 @@ parameters:

-
message: "#^Cannot access offset 'searchFilter' on mixed\\.$#"
count: 2
count: 1
path: src/Control/SearchBar/Suggestions.php

-
message: "#^Cannot access offset 'showQuickSearch' on mixed\\.$#"
count: 2
count: 1
path: src/Control/SearchBar/Suggestions.php

-
Expand Down Expand Up @@ -415,11 +400,6 @@ parameters:
count: 1
path: src/Control/SearchBar/Suggestions.php

-
message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\|false given\\.$#"
count: 1
path: src/Control/SearchBar/Suggestions.php

-
message: "#^Parameter \\#3 \\$searchFilter of method ipl\\\\Web\\\\Control\\\\SearchBar\\\\Suggestions\\:\\:fetchValueSuggestions\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Chain, ipl\\\\Stdlib\\\\Filter\\\\Rule given\\.$#"
count: 1
Expand Down Expand Up @@ -490,11 +470,6 @@ parameters:
count: 1
path: src/Control/SearchBar/Terms.php

-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Control/SearchBar/Terms.php

-
message: "#^Property ipl\\\\Web\\\\Control\\\\SearchBar\\\\Terms\\:\\:\\$changes type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -685,11 +660,6 @@ parameters:
count: 3
path: src/Control/SortControl.php

-
message: "#^Cannot access offset mixed on array\\|object\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Cannot call method getParsedBody\\(\\) on Psr\\\\Http\\\\Message\\\\ServerRequestInterface\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -730,21 +700,11 @@ parameters:
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#2 \\$start of static method ipl\\\\Stdlib\\\\Str\\:\\:startsWith\\(\\) expects string, mixed given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, int\\|string\\|null given\\.$#"
count: 1
path: src/Control/SortControl.php

-
message: "#^Part \\$column \\(mixed\\) of encapsed string cannot be cast to string\\.$#"
count: 3
Expand Down Expand Up @@ -815,11 +775,6 @@ parameters:
count: 1
path: src/Filter/Parser.php

-
message: "#^Parameter \\#1 \\$column of method ipl\\\\Web\\\\Filter\\\\Parser\\:\\:createCondition\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: src/Filter/Parser.php

-
message: "#^Parameter \\#1 \\$column of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects string, string\\|false given\\.$#"
count: 1
Expand Down Expand Up @@ -885,11 +840,6 @@ parameters:
count: 2
path: src/Filter/Parser.php

-
message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, mixed given\\.$#"
count: 1
path: src/Filter/Renderer.php

-
message: "#^Binary operation \"\\.\" between 'desc_' and array\\|bool\\|string\\|null results in an error\\.$#"
count: 1
Expand Down Expand Up @@ -1430,11 +1380,6 @@ parameters:
count: 1
path: src/FormElement/TermInput.php

-
message: "#^Parameter \\#1 \\$array of function array_push expects array, mixed given\\.$#"
count: 1
path: src/FormElement/TermInput.php

-
message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, string\\|false given\\.$#"
count: 3
Expand All @@ -1452,7 +1397,7 @@ parameters:

-
message: "#^Parameter \\#1 \\$value of method ipl\\\\Web\\\\FormElement\\\\TermInput\\:\\:parseValue\\(\\) expects string, mixed given\\.$#"
count: 2
count: 1
path: src/FormElement/TermInput.php

-
Expand Down Expand Up @@ -1635,11 +1580,6 @@ parameters:
count: 1
path: src/Widget/Tabs.php

-
message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Widget/Tabs.php

-
message: "#^Parameter \\#2 \\$tab of method Icinga\\\\Web\\\\Widget\\\\Tabs\\:\\:add\\(\\) expects array\\|Icinga\\\\Web\\\\Widget\\\\Tab, mixed given\\.$#"
count: 1
Expand Down
4 changes: 3 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 All @@ -14,6 +15,7 @@ parameters:
scanDirectories:
- /icingaweb2
- /usr/share/icinga-php/vendor
- /usr/share/icinga-php/ipl

ignoreErrors:
-
Expand Down

0 comments on commit 4a73bc6

Please sign in to comment.