Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^11.5",
"rector/rector-src": "dev-main",
"rector/type-perfect": "^2.1",
"symplify/easy-coding-standard": "^12.3",
"symplify/phpstan-extensions": "^12.0",
"symplify/phpstan-rules": "^14.9",
Expand Down
13 changes: 6 additions & 7 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
level: 8
errorFormat: symplify

reportUnmatchedIgnoredErrors: false
# reportUnmatchedIgnoredErrors: false

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

# see https://github.com/rectorphp/type-perfect/
# to be enabled later once rector upgraded to use phpstan v2
# type_perfect:
# no_mixed: true
# null_over_false: true
# narrow_param: true
# narrow_return: true
type_perfect:
no_mixed: true
null_over_false: true
narrow_param: true
narrow_return: true

ignoreErrors:
# php enum value minus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Rector\DowngradePhp85\Rector\StmtsAwareInterface;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\Pipe;
Expand Down Expand Up @@ -104,14 +105,14 @@ public function refactor(Node $node): ?Node
return $hasChanged ? $node : null;
}

private function findPipeNode(Node $node): ?Pipe
private function findPipeNode(Expr $expr): ?Pipe
{
if ($node instanceof Pipe) {
return $node;
if ($expr instanceof Pipe) {
return $expr;
}

if ($node instanceof Assign && $node->expr instanceof Pipe) {
return $node->expr;
if ($expr instanceof Assign && $expr->expr instanceof Pipe) {
return $expr->expr;
}

return null;
Expand Down