src/DefinitionResolver.php
private static function isVariableDeclaration(Node $n, string $name)
    {
        if (
            // TODO - clean this up
            ($n instanceof Node\Expression\AssignmentExpression && $n->operator->kind === PhpParser\TokenKind::EqualsToken)
            && $n->leftOperand instanceof Node\Expression\Variable && $n->leftOperand->getName() === $name
        ) {
            return true;
        }

        if (
            ($n instanceof Node\ForeachValue || $n instanceof Node\ForeachKey)
            && $n->expression instanceof Node\Expression\Variable
            && $n->expression->getName() === $name
        ) {
            return true;
        }

        return false;
    }
private static function isVariableDeclaration(Node $n, string $name)
    {
        if (
            // TODO - clean this up
            ($n instanceof Node\Expression\AssignmentExpression && $n->operator->kind === PhpParser\TokenKind::EqualsToken)
            && $n->leftOperand instanceof Node\Expression\Variable && $n->leftOperand->getName() === $name
        ) {
            return true;
        }

        if (
            ($n instanceof Node\ForeachValue || $n instanceof Node\ForeachKey)
            && $n->expression instanceof Node\Expression\Variable
            && $n->expression->getName() === $name
        ) {
            return true;
        }

        return false;
    }
private static function isVariableDeclaration ( Node $ n , string $ name ) { if ( // TODO - clean this up ( $ n instanceof Node \ Expression \ AssignmentExpression && $ n -> operator -> kind === PhpParser \ TokenKind :: EqualsToken ) && $ n -> leftOperand instanceof Node \ Expression \ Variable && $ n -> leftOperand -> getName ( ) === $ name ) { return true ; } if ( ( $ n instanceof Node \ ForeachValue || $ n instanceof Node \ ForeachKey ) && $ n -> expression instanceof Node \ Expression \ Variable && $ n -> expression -> getName ( ) === $ name ) { return true ; } return false ; }
Checks whether the given Node declares the given variable name

@param Node $n The Node to check
@param string $name The name of the wanted variable
@return bool
Checks whether the given Node declares the given variable name