Skip to content

Commit

Permalink
Phpstan: Create php version based baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jan 23, 2024
1 parent 4c25771 commit e27641d
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 146 deletions.
151 changes: 151 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$data of function hex2bin expects string, mixed given\\.$#"
count: 1
path: application/controllers/EventController.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/AcknowledgeProblemForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/AddCommentForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 1
path: application/forms/Command/Object/CheckNowForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/DeleteCommentForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/DeleteDowntimeForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ProcessCheckResultForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/RemoveAcknowledgementForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ScheduleCheckForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 1
path: application/forms/Command/Object/ScheduleHostDowntimeForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/SendCustomNotificationForm.php

-
message: "#^Parameter \\#1 \\$str of function md5 expects string, mixed given\\.$#"
count: 1
path: application/forms/RedisConfigForm.php

-
message: "#^Parameter \\#1 \\$stack of function array_pop expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Command/Transport/ApiCommandTransport.php

-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Command/Transport/CommandTransport.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/IcingaRedis.php

-
message: "#^Parameter \\#1 \\$arr1 of function array_diff_key expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php

-
message: "#^Parameter \\#1 \\$data of function bin2hex expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php

-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
count: 2
path: library/Icingadb/Compat/UrlMigrator.php

-
message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php

-
message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php

-
message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/PivotTable.php

-
message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Icingadb/Model/CustomvarFlat.php

-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php

-
message: "#^Parameter \\#1 \\$number of function number_format expects float, float\\|int\\|string given\\.$#"
count: 1
path: library/Icingadb/Util/PerfData.php

-
message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|null given\\.$#"
count: 1
path: library/Icingadb/Util/PluginOutput.php

-
message: "#^Parameter \\#3 \\$encoding of function htmlspecialchars expects string, null given\\.$#"
count: 1
path: library/Icingadb/Util/PluginOutput.php

-
message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Web/Controller.php

-
message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Web/Controller.php
146 changes: 146 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#"
count: 1
path: application/controllers/EventController.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/AcknowledgeProblemForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/AddCommentForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 1
path: application/forms/Command/Object/CheckNowForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/DeleteCommentForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/DeleteDowntimeForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ProcessCheckResultForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/RemoveAcknowledgementForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ScheduleCheckForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 1
path: application/forms/Command/Object/ScheduleHostDowntimeForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
count: 2
path: application/forms/Command/Object/SendCustomNotificationForm.php

-
message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#"
count: 1
path: application/forms/RedisConfigForm.php

-
message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Command/Transport/ApiCommandTransport.php

-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Command/Transport/CommandTransport.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/IcingaRedis.php

-
message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php

-
message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php

-
message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
count: 2
path: library/Icingadb/Compat/UrlMigrator.php

-
message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php

-
message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/PivotTable.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: library/Icingadb/Model/CustomvarFlat.php

-
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php

-
message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#"
count: 1
path: library/Icingadb/Util/PerfData.php

-
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#"
count: 1
path: library/Icingadb/Util/PluginOutput.php

-
message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Web/Controller.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Web/Controller.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
];
Loading

0 comments on commit e27641d

Please sign in to comment.