Skip to content

Commit

Permalink
phpstan: Split baselines into php version specific files
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Nov 16, 2023
1 parent e5f2949 commit 0189155
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 26 deletions.
12 changes: 12 additions & 0 deletions php-version-baseline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php declare(strict_types = 1);

$includes = [];
if (PHP_VERSION_ID >= 80000) {
$includes[] = __DIR__ . '/phpstan-baseline-8x.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
}

return [
'includes' => $includes
];
26 changes: 26 additions & 0 deletions phpstan-baseline-7x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$assoc of function json_decode expects bool\\|null, int given\\.$#"
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#"
count: 1
path: application/forms/ChannelForm.php

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

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

-
message: "#^Parameter \\#1 \\$time of function strtotime expects string, mixed given\\.$#"
count: 1
path: library/Notifications/Widget/Calendar.php
26 changes: 26 additions & 0 deletions phpstan-baseline-8x.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#2 \\$associative of function json_decode expects bool\\|null, int given\\.$#"
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 2
path: application/forms/EntryForm.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 2
path: application/forms/EscalationRecipientForm.php

-
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
count: 1
path: library/Notifications/Widget/Calendar.php
25 changes: 0 additions & 25 deletions phpstan-baseline.neon → phpstan-baseline-all.neon
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,6 @@ parameters:
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Parameter \\#2 \\$associative of function json_decode expects bool\\|null, int given\\.$#"
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
count: 1
path: application/forms/ChannelForm.php

-
message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Forms\\\\DatabaseConfigForm\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -565,11 +555,6 @@ parameters:
count: 2
path: application/forms/EntryForm.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 2
path: application/forms/EntryForm.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 @@ -670,11 +655,6 @@ parameters:
count: 1
path: application/forms/EscalationRecipientForm.php

-
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
count: 2
path: application/forms/EscalationRecipientForm.php

-
message: "#^Method Icinga\\\\Module\\\\Notifications\\\\Forms\\\\EventRuleForm\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1280,11 +1260,6 @@ parameters:
count: 1
path: library/Notifications/Widget/Calendar.php

-
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
count: 1
path: library/Notifications/Widget/Calendar.php

-
message: "#^Parameter \\#1 \\$from of static method Icinga\\\\Module\\\\Notifications\\\\Widget\\\\Calendar\\\\Util\\:\\:diffHours\\(\\) expects DateTime, DateTime\\|null given\\.$#"
count: 2
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-all.neon
- php-version-baseline.php

parameters:
level: max
Expand Down

0 comments on commit 0189155

Please sign in to comment.