Skip to content

Commit 9c81a80

Browse files
staabmondrejmirtes
authored andcommitted
Faster MutatingScope->getNodeKey()
1 parent b66058f commit 9c81a80

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Analyser/MutatingScope.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,16 @@ private function getNodeKey(Expr $node): string
710710
{
711711
$key = $this->exprPrinter->printExpr($node);
712712

713+
$attributes = $node->getAttributes();
713714
if (
714715
$node instanceof Node\FunctionLike
715-
&& $node->hasAttribute(ArrayMapArgVisitor::ATTRIBUTE_NAME)
716-
&& $node->hasAttribute('startFilePos')
716+
&& (($attributes[ArrayMapArgVisitor::ATTRIBUTE_NAME] ?? null) !== null)
717+
&& (($attributes['startFilePos'] ?? null) !== null)
717718
) {
718-
$key .= '/*' . $node->getAttribute('startFilePos') . '*/';
719+
$key .= '/*' . $attributes['startFilePos'] . '*/';
719720
}
720721

721-
if ($node->getAttribute(self::KEEP_VOID_ATTRIBUTE_NAME) === true) {
722+
if (($attributes[self::KEEP_VOID_ATTRIBUTE_NAME] ?? null) === true) {
722723
$key .= '/*' . self::KEEP_VOID_ATTRIBUTE_NAME . '*/';
723724
}
724725

0 commit comments

Comments
 (0)