Phan\AST\UnionTypeVisitor::visitType PHP Method

visitType() public method

Visit a node with kind \ast\AST_TYPE
public visitType ( 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.
return Phan\Language\UnionType The set of types that are possibly produced by the given node
    public function visitType(Node $node) : UnionType
    {
        switch ($node->flags) {
            case \ast\flags\TYPE_ARRAY:
                return ArrayType::instance()->asUnionType();
            case \ast\flags\TYPE_BOOL:
                return BoolType::instance()->asUnionType();
            case \ast\flags\TYPE_CALLABLE:
                return CallableType::instance()->asUnionType();
            case \ast\flags\TYPE_DOUBLE:
                return FloatType::instance()->asUnionType();
            case \ast\flags\TYPE_LONG:
                return IntType::instance()->asUnionType();
            case \ast\flags\TYPE_NULL:
                return NullType::instance()->asUnionType();
            case \ast\flags\TYPE_OBJECT:
                return ObjectType::instance()->asUnionType();
            case \ast\flags\TYPE_STRING:
                return StringType::instance()->asUnionType();
            default:
                assert(false, "All flags must match. Found " . Debug::astFlagDescription($node->flags ?? 0));
                break;
        }
    }