function isVariadic() { foreach ($this->function->getParams() as $param) { if ($param->variadic) { return true; } } if ($this->function instanceof Function_ || $this->function instanceof \PhpParser\Node\Stmt\ClassMethod) { return VariadicCheckVisitor::isVariadic($this->function->getStmts()); } return false; }
/** * Fetch an array of all return statements found within this function. * * Note that return statements within smaller scopes contained (e.g. anonymous classes, closures) are not returned * here as they are not within the immediate scope. * * @return Node\Stmt\Return_[] */ public function getReturnStatementsAst() { $visitor = new ReturnNodeVisitor(); $traverser = new NodeTraverser(); $traverser->addVisitor($visitor); $traverser->traverse($this->node->getStmts()); return $visitor->getReturnNodes(); }