public function visitFuncDecl(Decl $node) : Context
{
$function_name = (string) $node->name;
// Hunt for an un-taken alternate ID
$alternate_id = 0;
$function_fqsen = null;
do {
$function_fqsen = FullyQualifiedFunctionName::fromStringInContext($function_name, $this->context)->withNamespace($this->context->getNamespace())->withAlternateId($alternate_id++);
} while ($this->code_base->hasFunctionWithFQSEN($function_fqsen));
$func = Func::fromNode($this->context->withLineNumberStart($node->lineno ?? 0)->withLineNumberEnd($node->endLineno ?? 0), $this->code_base, $node, $function_fqsen);
$this->code_base->addFunction($func);
// Send the context into the function and reset the scope
$context = $this->context->withScope($func->getInternalScope());
return $context;
}