phpstan: Separate baseline by php version

This commit is contained in:
Sukhwinder Dhillon 2024-03-26 11:43:52 +01:00
parent 1f8d74a612
commit 087b1b6c8e
5 changed files with 186 additions and 116 deletions

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

@ -0,0 +1,81 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$fp of function fpassthru expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$fp of function fputcsv expects resource, resource\\|false given\\.$#"
count: 2
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$fp of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 2
path: library/Businessprocess/BpConfig.php
-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, array\\<Icinga\\\\Module\\\\Businessprocess\\\\Node\\>\\|null given\\.$#"
count: 1
path: library/Businessprocess/BpNode.php
-
message: "#^Parameter \\#1 \\$str of function ucfirst expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeAction.php
-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php
-
message: "#^Parameter \\#2 \\$search of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#"
count: 2
path: library/Businessprocess/State/IcingaDbState.php
-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$fp of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$stack of function array_shift expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#2 \\$args of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: library/Businessprocess/Web/Controller.php
-
message: "#^Parameter \\#1 \\$stack of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/FormLoader.php
-
message: "#^Parameter \\#1 \\$stack of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/QuickForm.php

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

@ -0,0 +1,81 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$stream of function fpassthru expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$stream of function fputcsv expects resource, resource\\|false given\\.$#"
count: 2
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$stream of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 2
path: library/Businessprocess/BpConfig.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, array\\<Icinga\\\\Module\\\\Businessprocess\\\\Node\\>\\|null given\\.$#"
count: 1
path: library/Businessprocess/BpNode.php
-
message: "#^Parameter \\#1 \\$string of function ucfirst expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeAction.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 2
path: library/Businessprocess/State/IcingaDbState.php
-
message: "#^Parameter \\#1 \\$array of function array_shift expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$stream of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: library/Businessprocess/Web/Controller.php
-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/FormLoader.php
-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/QuickForm.php

View file

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

View file

@ -285,26 +285,6 @@ parameters:
count: 1 count: 1
path: application/controllers/ProcessController.php path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$stream of function fpassthru expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$stream of function fputcsv expects resource, resource\\|false given\\.$#"
count: 2
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$stream of function rewind expects resource, resource\\|false given\\.$#"
count: 1
path: application/controllers/ProcessController.php
-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: application/controllers/ProcessController.php
- -
message: "#^Parameter \\#1 \\(mixed\\) of echo cannot be converted to string\\.$#" message: "#^Parameter \\#1 \\(mixed\\) of echo cannot be converted to string\\.$#"
count: 1 count: 1
@ -505,11 +485,6 @@ parameters:
count: 1 count: 1
path: application/forms/AddNodeForm.php path: application/forms/AddNodeForm.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: application/forms/AddNodeForm.php
- -
message: "#^Cannot call method getLabel\\(\\) on Zend_Form_Element\\|null\\.$#" message: "#^Cannot call method getLabel\\(\\) on Zend_Form_Element\\|null\\.$#"
count: 1 count: 1
@ -1280,11 +1255,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/BpConfig.php path: library/Businessprocess/BpConfig.php
-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 2
path: library/Businessprocess/BpConfig.php
- -
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\BpConfig\\:\\:\\$changeCount has no type specified\\.$#" message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\BpConfig\\:\\:\\$changeCount has no type specified\\.$#"
count: 1 count: 1
@ -1555,11 +1525,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/BpNode.php path: library/Businessprocess/BpNode.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, array\\<Icinga\\\\Module\\\\Businessprocess\\\\Node\\>\\|null given\\.$#"
count: 1
path: library/Businessprocess/BpNode.php
- -
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\:\\:\\$childNames type has no value type specified in iterable type array\\.$#" message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\:\\:\\$childNames type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -1995,11 +1960,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Modification/NodeAction.php path: library/Businessprocess/Modification/NodeAction.php
-
message: "#^Parameter \\#1 \\$string of function ucfirst expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeAction.php
- -
message: "#^Parameter \\#2 \\$nodeName of static method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeAction\\:\\:create\\(\\) expects string, mixed given\\.$#" message: "#^Parameter \\#2 \\$nodeName of static method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeAction\\:\\:create\\(\\) expects string, mixed given\\.$#"
count: 1 count: 1
@ -2055,11 +2015,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Modification/NodeApplyManualOrderAction.php path: library/Businessprocess/Modification/NodeApplyManualOrderAction.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeApplyManualOrderAction.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeCopyAction\\:\\:applyManualSorting\\(\\) has parameter \\$bpNodes with no value type specified in iterable type array\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeCopyAction\\:\\:applyManualSorting\\(\\) has parameter \\$bpNodes with no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -2080,11 +2035,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Modification/NodeCopyAction.php path: library/Businessprocess/Modification/NodeCopyAction.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeCopyAction.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeCreateAction\\:\\:getProperties\\(\\) return type has no value type specified in iterable type array\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeCreateAction\\:\\:getProperties\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1 count: 1
@ -2235,11 +2185,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Modification/NodeMoveAction.php path: library/Businessprocess/Modification/NodeMoveAction.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: library/Businessprocess/Modification/NodeMoveAction.php
- -
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeMoveAction\\:\\:\\$from \\(int\\) does not accept int\\|false\\.$#" message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Modification\\\\NodeMoveAction\\:\\:\\$from \\(int\\) does not accept int\\|false\\.$#"
count: 1 count: 1
@ -2350,11 +2295,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/HostStatusQuery.php
- -
message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1 count: 1
@ -2375,11 +2315,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php
-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
count: 1
path: library/Businessprocess/Monitoring/Backend/Ido/Query/ServiceStatusQuery.php
- -
message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#" message: "#^Parameter \\#4 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1 count: 1
@ -2740,21 +2675,11 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Node.php path: library/Businessprocess/Node.php
-
message: "#^Parameter \\#1 \\$name of static method Icinga\\\\Module\\\\Businessprocess\\\\BpConfig\\:\\:joinNodeName\\(\\) expects string, mixed given\\.$#"
count: 1
path: library/Businessprocess/ProvidedHook/Icingadb/HostActions.php
- -
message: "#^Cannot access property \\$name on mixed\\.$#" message: "#^Cannot access property \\$name on mixed\\.$#"
count: 1 count: 1
path: library/Businessprocess/ProvidedHook/Icingadb/ServiceActions.php path: library/Businessprocess/ProvidedHook/Icingadb/ServiceActions.php
-
message: "#^Parameter \\#2 \\$suffix of static method Icinga\\\\Module\\\\Businessprocess\\\\BpConfig\\:\\:joinNodeName\\(\\) expects string\\|null, mixed given\\.$#"
count: 1
path: library/Businessprocess/ProvidedHook/Icingadb/ServiceActions.php
- -
message: "#^Cannot access offset 'icingacli…' on mixed\\.$#" message: "#^Cannot access offset 'icingacli…' on mixed\\.$#"
count: 2 count: 2
@ -2915,11 +2840,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Renderer/Renderer.php path: library/Businessprocess/Renderer/Renderer.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: library/Businessprocess/Renderer/Renderer.php
- -
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Renderer\\\\Renderer\\:\\:\\$parent \\(Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\) does not accept Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\|null\\.$#" message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Renderer\\\\Renderer\\:\\:\\$parent \\(Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\) does not accept Icinga\\\\Module\\\\Businessprocess\\\\BpNode\\|null\\.$#"
count: 1 count: 1
@ -3245,11 +3165,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/State/IcingaDbState.php path: library/Businessprocess/State/IcingaDbState.php
-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 2
path: library/Businessprocess/State/IcingaDbState.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\State\\\\MonitoringState\\:\\:apply\\(\\) has no return type specified\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\State\\\\MonitoringState\\:\\:apply\\(\\) has no return type specified\\.$#"
count: 1 count: 1
@ -3530,11 +3445,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$array of function array_shift expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
- -
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|null given\\.$#" message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|null given\\.$#"
count: 1 count: 1
@ -3545,16 +3455,6 @@ parameters:
count: 2 count: 2
path: library/Businessprocess/Storage/LegacyConfigParser.php path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
-
message: "#^Parameter \\#1 \\$stream of function fgets expects resource, resource\\|false given\\.$#"
count: 1
path: library/Businessprocess/Storage/LegacyConfigParser.php
- -
message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|null given\\.$#" message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|null given\\.$#"
count: 1 count: 1
@ -3670,6 +3570,11 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Storage/LegacyStorage.php path: library/Businessprocess/Storage/LegacyStorage.php
-
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Storage\\\\Storage\\:\\:__construct\\(\\) has parameter \\$config with generic class Icinga\\\\Data\\\\ConfigObject but does not specify its types\\: TValue$#"
count: 1
path: library/Businessprocess/Storage/Storage.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Storage\\\\Storage\\:\\:deleteProcess\\(\\) has parameter \\$name with no type specified\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Storage\\\\Storage\\:\\:deleteProcess\\(\\) has parameter \\$name with no type specified\\.$#"
count: 1 count: 1
@ -3710,6 +3615,11 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Storage/Storage.php path: library/Businessprocess/Storage/Storage.php
-
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Storage\\\\Storage\\:\\:\\$config with generic class Icinga\\\\Data\\\\ConfigObject does not specify its types\\: TValue$#"
count: 1
path: library/Businessprocess/Storage/Storage.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Component\\\\BpDashboardTile\\:\\:__construct\\(\\) has parameter \\$attributes with no type specified\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Component\\\\BpDashboardTile\\:\\:__construct\\(\\) has parameter \\$attributes with no type specified\\.$#"
count: 1 count: 1
@ -3850,11 +3760,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Web/Controller.php path: library/Businessprocess/Web/Controller.php
-
message: "#^Parameter \\#2 \\$values of function vsprintf expects array\\<bool\\|float\\|int\\|string\\|null\\>, array\\<int, mixed\\> given\\.$#"
count: 1
path: library/Businessprocess/Web/Controller.php
- -
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\FakeRequest\\:\\:getBaseUrl\\(\\) has parameter \\$raw with no type specified\\.$#" message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\FakeRequest\\:\\:getBaseUrl\\(\\) has parameter \\$raw with no type specified\\.$#"
count: 1 count: 1
@ -3940,11 +3845,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Web/Form/FormLoader.php path: library/Businessprocess/Web/Form/FormLoader.php
-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/FormLoader.php
- -
message: "#^Cannot call method setDecorators\\(\\) on Zend_Form_Element\\|null\\.$#" message: "#^Cannot call method setDecorators\\(\\) on Zend_Form_Element\\|null\\.$#"
count: 1 count: 1
@ -4390,11 +4290,6 @@ parameters:
count: 1 count: 1
path: library/Businessprocess/Web/Form/QuickForm.php path: library/Businessprocess/Web/Form/QuickForm.php
-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Businessprocess/Web/Form/QuickForm.php
- -
message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Form\\\\QuickForm\\:\\:\\$deleteButtonName has no type specified\\.$#" message: "#^Property Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Form\\\\QuickForm\\:\\:\\$deleteButtonName has no type specified\\.$#"
count: 1 count: 1

View file

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