Phan\AST\UnionTypeVisitor::visitClosure PHP Method

visitClosure() public method

Visit a node with kind \ast\AST_CLOSURE
public visitClosure ( ast\Node\Decl $node ) : UnionType
$node ast\Node\Decl 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 visitClosure(Decl $node) : UnionType
    {
        // The type of a closure is the fqsen pointing
        // at its definition
        $closure_fqsen = FullyQualifiedFunctionName::fromClosureInContext($this->context);
        $type = CallableType::instanceWithClosureFQSEN($closure_fqsen)->asUnionType();
        return $type;
    }