Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 6, 2025
1 parent cd74454 commit 8a428e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rules/DeadCode/Rector/If_/RemoveDeadInstanceOfRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use Rector\NodeManipulator\IfManipulator;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Rector\AbstractRector;
use Rector\Reflection\ReflectionResolver;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
Expand Down Expand Up @@ -110,6 +111,7 @@ private function refactorStmtAndInstanceof(If_ $if, Instanceof_ $instanceof): nu
}

if ($instanceof->expr instanceof Assign) {
$instanceof->expr->getAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, false);
$assignExpression = new Expression($instanceof->expr);
return array_merge([$assignExpression], $if->stmts);
}
Expand Down

0 comments on commit 8a428e0

Please sign in to comment.