Phan\Parse\ParseVisitor::visitFuncDecl PHP Метод

visitFuncDecl() публичный Метод

Visit a node with kind \ast\AST_FUNC_DECL
public visitFuncDecl ( ast\Node\Decl $node ) : Context
$node ast\Node\Decl A node to parse
Результат Phan\Language\Context A new or an unchanged context resulting from parsing the node
    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;
    }