Phan\Analysis\PostOrderAnalysisVisitor::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
    {
        $method = $this->context->getFunctionLikeInScope($this->code_base);
        $return_type = $method->getUnionType();
        if (!$return_type->isEmpty() && !$method->getHasReturn() && !$this->declOnlyThrows($node) && !$return_type->hasType(VoidType::instance()) && !$return_type->hasType(NullType::instance())) {
            $this->emitIssue(Issue::TypeMissingReturn, $node->lineno ?? 0, (string) $method->getFQSEN(), (string) $return_type);
        }
        $parameters_seen = [];
        foreach ($method->getParameterList() as $i => $parameter) {
            if (isset($parameters_seen[$parameter->getName()])) {
                $this->emitIssue(Issue::ParamRedefined, $node->lineno ?? 0, '$' . $parameter->getName());
            } else {
                $parameters_seen[$parameter->getName()] = $i;
            }
        }
        return $this->context;
    }