/** * Visit a node with kind `\ast\AST_CLOSURE` * * @param Node $node * A node of the type indicated by the method name that we'd * like to figure out the type that it produces. * * @return 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; }