Phan\AST\UnionTypeVisitor::visitName PHP Метод

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

Visit a node with kind \ast\AST_NAME
public visitName ( ast\Node $node ) : UnionType
$node ast\Node A node of the type indicated by the method name that we'd like to figure out the type that it produces.
Результат Phan\Language\UnionType The set of types that are possibly produced by the given node
    public function visitName(Node $node) : UnionType
    {
        if ($node->flags & \ast\flags\NAME_NOT_FQ) {
            if ('parent' === $node->children['name']) {
                $class = $this->context->getClassInScope($this->code_base);
                if ($class->hasParentType()) {
                    return Type::fromFullyQualifiedString((string) $class->getParentClassFQSEN())->asUnionType();
                } else {
                    if (!$class->isTrait()) {
                        $this->emitIssue(Issue::ParentlessClass, $node->lineno ?? 0, (string) $class->getFQSEN());
                    }
                    return new UnionType();
                }
            }
            if ('self' === $node->children['name'] && $this->context->getClassInScope($this->code_base)->isTrait()) {
                return new UnionType();
            }
            return Type::fromStringInContext($node->children['name'], $this->context)->asUnionType();
        }
        return Type::fromFullyQualifiedString('\\' . $node->children['name'])->asUnionType();
    }