public function visitCall(Node $node) : UnionType
{
// Things like `$func()`. We don't understand these.
if ($node->children['expr']->kind !== \ast\AST_NAME) {
return new UnionType();
}
$function_name = $node->children['expr']->children['name'];
try {
$function = (new ContextNode($this->code_base, $this->context, $node->children['expr']))->getFunction($function_name);
} catch (CodeBaseException $exception) {
// If the function wasn't declared, it'll be caught
// and reported elsewhere
return new UnionType();
}
$function_fqsen = $function->getFQSEN();
// TODO: I don't believe we need this any more
// If this is an internal function, see if we can get
// its types from the static dataset.
if ($function->isInternal() && $function->getUnionType()->isEmpty()) {
$map = UnionType::internalFunctionSignatureMapForFQSEN($function->getFQSEN());
return $map[$function_name] ?? new UnionType();
}
return $function->getUnionType();
}