Skip to content

Commit

Permalink
[NodeManipulator] clean up multiple instanceof check on AssignManipul…
Browse files Browse the repository at this point in the history
…ator (#3695)

* clean up multiple instanceof check on AssignManipulator

* use var type
  • Loading branch information
samsonasik committed May 8, 2023
1 parent 4a340be commit 3d7e89f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/NodeManipulator/AssignManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ public function isLeftPartOfAssign(Node $node): bool
$parentNode = $parentNode->getAttribute(AttributeKey::PARENT_NODE);
}

if ($parentNode instanceof Assign || $parentNode instanceof AssignOp || $parentNode instanceof PreDec || $parentNode instanceof PreInc || $parentNode instanceof PostDec || $parentNode instanceof PostInc) {
if ($parentNode instanceof Node && $this->multiInstanceofChecker->isInstanceOf(
$parentNode,
[Assign::class, ...self::MODIFYING_NODE_TYPES]
)) {
/** @var Assign|AssignOp|PreDec|PostDec|PreInc|PostInc $parentNode */
return $parentNode->var === $previousParent;
}
}
Expand Down

0 comments on commit 3d7e89f

Please sign in to comment.