Skip to content

Commit

Permalink
Require phpstan/phpstan:^2
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Dec 29, 2024
1 parent 198d245 commit 638150e
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 43 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"infection/infection": "^0.26.0|^0.27.0|^0.28.0|^0.29.0",
"orisai/coding-standard": "^3.0.0",
"phpstan/extension-installer": "^1.0.0",
"phpstan/phpstan": "^1.0.0",
"phpstan/phpstan-deprecation-rules": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpstan/phpstan": "^2.0.0",
"phpstan/phpstan-deprecation-rules": "^2.0.0",
"phpstan/phpstan-phpunit": "^2.0.0",
"phpstan/phpstan-strict-rules": "^2.0.0",
"phpunit/phpunit": "^9.5.0",
"staabm/annotate-pull-request-from-checkstyle": "^1.7.0"
},
Expand Down
117 changes: 78 additions & 39 deletions tools/phpstan.baseline.neon
Original file line number Diff line number Diff line change
@@ -1,196 +1,235 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$expression of method Orisai\\\\CronExpressionExplainer\\\\CronExpressionExplainer\\:\\:explain\\(\\) expects string, string\\|null given\\.$#"
message: '#^Parameter \#1 \$expression of method Orisai\\CronExpressionExplainer\\CronExpressionExplainer\:\:explain\(\) expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: ../src/Command/ExplainCommand.php

-
message: "#^Only booleans are allowed in a ternary operator condition, mixed given\\.$#"
message: '#^Only booleans are allowed in a ternary operator condition, mixed given\.$#'
identifier: ternary.condNotBoolean
count: 1
path: ../src/Command/RunCommand.php

-
message: "#^Only booleans are allowed in a negated boolean, mixed given\\.$#"
message: '#^Only booleans are allowed in a negated boolean, mixed given\.$#'
identifier: booleanNot.exprNotBoolean
count: 1
path: ../src/Command/RunJobCommand.php

-
message: "#^Only booleans are allowed in an if condition, mixed given\\.$#"
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
identifier: if.condNotBoolean
count: 2
path: ../src/Command/RunJobCommand.php

-
message: "#^Loose comparison via \"\\!\\=\" is not allowed\\.$#"
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
identifier: notEqual.notAllowed
count: 1
path: ../src/Command/WorkerCommand.php

-
message: "#^Call to function assert\\(\\) with true will always evaluate to true\\.$#"
message: '#^Call to function assert\(\) with true will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
count: 1
path: ../src/Executor/ProcessJobExecutor.php

-
message: "#^Cannot call method setTimezone\\(\\) on DateTimeImmutable\\|false\\.$#"
message: '#^Cannot call method setTimezone\(\) on DateTimeImmutable\|false\.$#'
identifier: method.nonObject
count: 2
path: ../src/Executor/ProcessJobExecutor.php

-
message: "#^Instanceof between Symfony\\\\Component\\\\Process\\\\Process and Symfony\\\\Component\\\\Process\\\\Process will always evaluate to true\\.$#"
message: '#^Instanceof between Symfony\\Component\\Process\\Process and Symfony\\Component\\Process\\Process will always evaluate to true\.$#'
identifier: instanceof.alwaysTrue
count: 1
path: ../src/Executor/ProcessJobExecutor.php

-
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|false given\\.$#"
message: '#^Parameter \#3 \$subject of function str_replace expects array\<string\>\|string, string\|false given\.$#'
identifier: argument.type
count: 1
path: ../src/Job/CallbackJob.php

-
message: "#^Parameter \\#3 \\$expression of class Orisai\\\\Scheduler\\\\Status\\\\JobInfo constructor expects string, string\\|null given\\.$#"
message: '#^Parameter \#3 \$expression of class Orisai\\Scheduler\\Status\\JobInfo constructor expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: ../src/ManagedScheduler.php

-
message: "#^Parameter \\#3 \\$expression of class Orisai\\\\Scheduler\\\\Status\\\\PlannedJobInfo constructor expects string, string\\|null given\\.$#"
message: '#^Parameter \#3 \$expression of class Orisai\\Scheduler\\Status\\PlannedJobInfo constructor expects string, string\|null given\.$#'
identifier: argument.type
count: 1
path: ../src/ManagedScheduler.php

-
message: "#^Method Orisai\\\\Scheduler\\\\Status\\\\PlannedJobInfo\\:\\:getRunsCountPerMinute\\(\\) should return int\\<1, max\\> but returns int\\.$#"
message: '#^Method Orisai\\Scheduler\\Status\\PlannedJobInfo\:\:getRunsCountPerMinute\(\) should return int\<1, max\> but returns int\.$#'
identifier: return.type
count: 2
path: ../src/Status/PlannedJobInfo.php

-
message: "#^Parameter \\#1 \\$expected of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) contains unresolvable type\\.$#"
message: '#^Parameter \#1 \$expected of static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) contains unresolvable type\.$#'
identifier: argument.unresolvableType
count: 2
path: ../tests/Unit/Command/ExplainCommandTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 2 and 1 will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 2 and 1 will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/Job/CallbackJobTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Orisai\\\\\\\\Scheduler\\\\\\\\Status\\\\\\\\JobSummary' and Orisai\\\\Scheduler\\\\Status\\\\JobSummary will always evaluate to true\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Orisai\\\\Scheduler\\\\Status\\\\JobSummary'' and Orisai\\Scheduler\\Status\\JobSummary will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Tests\\\\\\\\Orisai\\\\\\\\Scheduler\\\\\\\\Doubles\\\\\\\\JobInnerFailure' and null will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Tests\\\\Orisai\\\\Scheduler\\\\Doubles\\\\JobInnerFailure'' and null will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 2
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Throwable' and Throwable will always evaluate to true\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Throwable'' and Throwable will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with Orisai\\\\Scheduler\\\\Status\\\\JobSummary will always evaluate to true\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertNotNull\(\) with Orisai\\Scheduler\\Status\\JobSummary will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 3
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with null will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertNotNull\(\) with null will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 6
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 0 and 0 will always evaluate to true\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 0 and 0 will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 2
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 1 and 0 will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 1 and 0 will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 3
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 1 and 1 will always evaluate to true\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 1 and 1 will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 2 and \\*NEVER\\* will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 2 and \*NEVER\* will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 5
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 2 and 1 will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 2 and 1 will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 4
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 3 and \\*NEVER\\* will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 3 and \*NEVER\* will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 4
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 3 and 1 will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 3 and 1 will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 4 and \\*NEVER\\* will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 4 and \*NEVER\* will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 3
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 4 and 2 will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 4 and 2 will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 5 and \\*NEVER\\* will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 5 and \*NEVER\* will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with 6 and \\*NEVER\\* will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with 6 and \*NEVER\* will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with array\\{'\\* \\* \\* \\* \\*', '1 \\* \\* \\* \\*'\\} and array\\{\\} will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''\* \* \* \* \*'', ''1 \* \* \* \*''\} and array\{\} will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with array\\{'\\* \\* \\* \\* \\*'\\} and array\\{\\} will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''\* \* \* \* \*''\} and array\{\} will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertTrue\\(\\) with false will always evaluate to false\\.$#"
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with false will always evaluate to false\.$#'
identifier: staticMethod.impossibleType
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Dead catch \\- Tests\\\\Orisai\\\\Scheduler\\\\Doubles\\\\JobInnerFailure is never thrown in the try block\\.$#"
message: '#^Dead catch \- Tests\\Orisai\\Scheduler\\Doubles\\JobInnerFailure is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 2
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^If condition is always true\\.$#"
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 3
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Parameter \\#2 \\$end of class Orisai\\\\Scheduler\\\\Status\\\\JobResult constructor expects DateTimeImmutable, DateTimeImmutable\\|false given\\.$#"
message: '#^Parameter \#2 \$end of class Orisai\\Scheduler\\Status\\JobResult constructor expects DateTimeImmutable, DateTimeImmutable\|false given\.$#'
identifier: argument.type
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Parameter \\#6 \\$start of class Orisai\\\\Scheduler\\\\Status\\\\JobInfo constructor expects DateTimeImmutable, DateTimeImmutable\\|false given\\.$#"
message: '#^Parameter \#6 \$start of class Orisai\\Scheduler\\Status\\JobInfo constructor expects DateTimeImmutable, DateTimeImmutable\|false given\.$#'
identifier: argument.type
count: 2
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
message: '#^Unreachable statement \- code above always terminates\.$#'
identifier: deadCode.unreachable
count: 1
path: ../tests/Unit/SimpleSchedulerTest.php

-
message: "#^Parameter \\#2 \\$end of class Orisai\\\\Scheduler\\\\Status\\\\JobResult constructor expects DateTimeImmutable, DateTimeImmutable\\|false given\\.$#"
message: '#^Parameter \#2 \$end of class Orisai\\Scheduler\\Status\\JobResult constructor expects DateTimeImmutable, DateTimeImmutable\|false given\.$#'
identifier: argument.type
count: 1
path: ../tests/Unit/Status/JobResultTest.php

0 comments on commit 638150e

Please sign in to comment.