Phan\AST\UnionTypeVisitor::classListFromNode PHP Method

classListFromNode() private method

private classListFromNode ( ast\Node $node ) : Generator | Clazz[]
$node ast\Node
return Generator | Phan\Language\Element\Clazz[] A list of classes associated with the given node
    private function classListFromNode(Node $node)
    {
        // Get the types associated with the node
        $union_type = self::unionTypeFromNode($this->code_base, $this->context, $node);
        // Iterate over each viable class type to see if any
        // have the constant we're looking for
        foreach ($union_type->nonNativeTypes()->getTypeSet() as $class_type) {
            // Get the class FQSEN
            $class_fqsen = $class_type->asFQSEN();
            // See if the class exists
            if (!$this->code_base->hasClassWithFQSEN($class_fqsen)) {
                throw new IssueException(Issue::fromType(Issue::UndeclaredClassReference)($this->context->getFile(), $node->lineno ?? 0, [(string) $class_fqsen]));
            }
            (yield $this->code_base->getClassByFQSEN($class_fqsen));
        }
    }