PHPSA\Compiler\Expression::getNodeName PHP Метод

getNodeName() публичный Метод

public getNodeName ( Name $expr ) : CompiledExpression
$expr PhpParser\Node\Name
Результат PHPSA\CompiledExpression
    public function getNodeName(Node\Name $expr)
    {
        $nodeString = $expr->toString();
        if ($nodeString === 'null') {
            return new CompiledExpression(CompiledExpression::NULL);
        }
        if (in_array($nodeString, ['parent'], true)) {
            /** @var ClassDefinition $scope */
            $scope = $this->context->scope;
            assert($scope instanceof ClassDefinition);
            if ($scope->getExtendsClass()) {
                $definition = $scope->getExtendsClassDefinition();
                if ($definition) {
                    return new CompiledExpression(CompiledExpression::OBJECT, $definition);
                }
            } else {
                $this->context->notice('language_error', 'Cannot access parent:: when current class scope has no parent', $expr);
            }
        }
        if (in_array($nodeString, ['self', 'static'], true)) {
            return CompiledExpression::fromZvalValue($this->context->scope);
        }
        if (defined($nodeString)) {
            return CompiledExpression::fromZvalValue(constant($expr));
        }
        return new CompiledExpression(CompiledExpression::STRING, $expr->toString());
    }