Skip to content

Commit

Permalink
Enable PHPStan bleeding edge rules
Browse files Browse the repository at this point in the history
I did not work on fixing issues because I don't know if bleeding edge rules are going to be accepted by maintainers.
  • Loading branch information
Wirone committed Dec 1, 2023
1 parent d710d47 commit 7eaef75
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
72 changes: 71 additions & 1 deletion phpstan-baseline.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
<?php declare(strict_types = 1);

$ignoreErrors = [];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 2,
'path' => __DIR__ . '/src/Prophecy/Argument/ArgumentsWildcard.php',
];
$ignoreErrors[] = [
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Argument/Token/ArrayEntryToken.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc tag @var with type callable\\(int\\|false, int\\|false\\)\\: \\(int\\|false\\) is not subtype of native type Closure\\(mixed, mixed\\)\\: mixed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Argument/Token/ArrayEntryToken.php',
];
$ignoreErrors[] = [
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 2,
'path' => __DIR__ . '/src/Prophecy/Argument/Token/ExactValueToken.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$value of function strval expects bool\\|float\\|int\\|resource\\|string\\|null, mixed given\\.$#',
'count' => 2,
Expand Down Expand Up @@ -71,6 +86,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Call/Call.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Call/CallCenter.php',
];
$ignoreErrors[] = [
'message' => '#^Method Prophecy\\\\Call\\\\CallCenter\\:\\:indentArguments\\(\\) should return array\\<string\\> but returns array\\<string\\>\\|null\\.$#',
'count' => 1,
Expand All @@ -92,7 +112,7 @@
'path' => __DIR__ . '/src/Prophecy/Call/CallCenter.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#6 \\$processed \\(array\\<int, array\\{object, object\\}\\>\\) of method Prophecy\\\\Comparator\\\\ProphecyComparator\\:\\:assertEquals\\(\\) should be contravariant with parameter \\$processed \\(array\\) of method SebastianBergmann\\\\Comparator\\\\ObjectComparator\\:\\:assertEquals\\(\\)$#',
'message' => '#^Parameter \\#6 \\$processed \\(list\\<array\\{object, object\\}\\>\\) of method Prophecy\\\\Comparator\\\\ProphecyComparator\\:\\:assertEquals\\(\\) should be contravariant with parameter \\$processed \\(array\\) of method SebastianBergmann\\\\Comparator\\\\ObjectComparator\\:\\:assertEquals\\(\\)$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Comparator/ProphecyComparator.php',
];
Expand Down Expand Up @@ -186,6 +206,21 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/ClassMirror.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\!\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/ClassMirror.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/ClassMirror.php',
];
$ignoreErrors[] = [
'message' => '#^Method Prophecy\\\\Doubler\\\\Generator\\\\ClassMirror\\:\\:getTypeHints\\(\\) should return list\\<string\\> but returns array\\<string\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/ClassMirror.php',
];
$ignoreErrors[] = [
'message' => '#^Only booleans are allowed in &&, ReflectionType\\|null given on the right side\\.$#',
'count' => 1,
Expand Down Expand Up @@ -231,6 +266,16 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/Node/MethodNode.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/Node/ReturnTypeNode.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 5,
'path' => __DIR__ . '/src/Prophecy/Doubler/Generator/Node/TypeNodeAbstract.php',
];
$ignoreErrors[] = [
'message' => '#^Only booleans are allowed in a negated boolean, int\\<0, max\\> given\\.$#',
'count' => 1,
Expand All @@ -251,6 +296,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/CallPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/CallTimesPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Only booleans are allowed in an elseif condition, int\\<0, max\\> given\\.$#',
'count' => 1,
Expand All @@ -261,6 +311,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/CallTimesPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#4 \\$calls of class Prophecy\\\\Exception\\\\Prediction\\\\UnexpectedCallsCountException constructor expects list\\<Prophecy\\\\Call\\\\Call\\>, array\\<Prophecy\\\\Call\\\\Call\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/CallTimesPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
Expand All @@ -276,6 +331,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/NoCallsPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#3 \\$calls of class Prophecy\\\\Exception\\\\Prediction\\\\UnexpectedCallsException constructor expects list\\<Prophecy\\\\Call\\\\Call\\>, non\\-empty\\-array\\<Prophecy\\\\Call\\\\Call\\> given\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prediction/NoCallsPrediction.php',
];
$ignoreErrors[] = [
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
'count' => 1,
Expand All @@ -291,6 +351,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Promise/ReturnPromise.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Promise/ThrowPromise.php',
];
$ignoreErrors[] = [
'message' => '#^Only booleans are allowed in a negated boolean, Doctrine\\\\Instantiator\\\\Instantiator\\|null given\\.$#',
'count' => 1,
Expand All @@ -301,6 +366,11 @@
'count' => 1,
'path' => __DIR__ . '/src/Prophecy/Prophecy/MethodProphecy.php',
];
$ignoreErrors[] = [
'message' => '#^Loose comparison via "\\=\\=" is not allowed\\.$#',
'count' => 2,
'path' => __DIR__ . '/src/Prophecy/Prophecy/MethodProphecy.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(ReflectionIntersectionType\\|ReflectionNamedType\\)\\: mixed\\)\\|null, Closure\\(ReflectionNamedType\\)\\: string given\\.$#',
'count' => 1,
Expand Down
1 change: 1 addition & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ parameters:
includes:
- phpstan-baseline.php
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

0 comments on commit 7eaef75

Please sign in to comment.