Skip to content

Commit

Permalink
[Core] Refactor NodeComparator::areSameNode() to always compare print…
Browse files Browse the repository at this point in the history
…ed node on last (#3193)
  • Loading branch information
samsonasik committed Dec 13, 2022
1 parent d80ddd1 commit 30bc9ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/PhpParser/Comparing/NodeComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ public function areSameNode(Node $firstNode, Node $secondNode): bool
return false;
}

return $firstNode->getEndTokenPos() === $secondNode->getEndTokenPos();
if ($firstNode->getEndTokenPos() !== $secondNode->getEndTokenPos()) {
return false;
}

$printFirstNode = $this->nodePrinter->print($firstNode);
$printSecondNode = $this->nodePrinter->print($secondNode);

return $printFirstNode === $printSecondNode;
}
}

0 comments on commit 30bc9ac

Please sign in to comment.