Skip to content

Commit 10c7be9

Browse files
authored
tv bump type perfect (#351)
* misc * enable type perfectx
1 parent c263ce2 commit 10c7be9

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"phpstan/phpstan-webmozart-assert": "^2.0",
1313
"phpunit/phpunit": "^11.5",
1414
"rector/rector-src": "dev-main",
15+
"rector/type-perfect": "^2.1",
1516
"symplify/easy-coding-standard": "^12.3",
1617
"symplify/phpstan-extensions": "^12.0",
1718
"symplify/phpstan-rules": "^14.9",

phpstan.neon

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ parameters:
66
level: 8
77
errorFormat: symplify
88

9-
reportUnmatchedIgnoredErrors: false
9+
# reportUnmatchedIgnoredErrors: false
1010

1111
# see https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases
1212
typeAliases:
@@ -31,12 +31,11 @@ parameters:
3131
- '*/Source/*'
3232

3333
# see https://github.com/rectorphp/type-perfect/
34-
# to be enabled later once rector upgraded to use phpstan v2
35-
# type_perfect:
36-
# no_mixed: true
37-
# null_over_false: true
38-
# narrow_param: true
39-
# narrow_return: true
34+
type_perfect:
35+
no_mixed: true
36+
null_over_false: true
37+
narrow_param: true
38+
narrow_return: true
4039

4140
ignoreErrors:
4241
# php enum value minus

rules/DowngradePhp85/Rector/StmtsAwareInterface/DowngradePipeOperatorRector.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Rector\DowngradePhp85\Rector\StmtsAwareInterface;
66

77
use PhpParser\Node;
8+
use PhpParser\Node\Expr;
89
use PhpParser\Node\Expr\ArrowFunction;
910
use PhpParser\Node\Expr\Assign;
1011
use PhpParser\Node\Expr\BinaryOp\Pipe;
@@ -104,14 +105,14 @@ public function refactor(Node $node): ?Node
104105
return $hasChanged ? $node : null;
105106
}
106107

107-
private function findPipeNode(Node $node): ?Pipe
108+
private function findPipeNode(Expr $expr): ?Pipe
108109
{
109-
if ($node instanceof Pipe) {
110-
return $node;
110+
if ($expr instanceof Pipe) {
111+
return $expr;
111112
}
112113

113-
if ($node instanceof Assign && $node->expr instanceof Pipe) {
114-
return $node->expr;
114+
if ($expr instanceof Assign && $expr->expr instanceof Pipe) {
115+
return $expr->expr;
115116
}
116117

117118
return null;

0 commit comments

Comments
 (0)