Inheritance: extends PhpParser\Node\Stmt, implements PhpParser\Node\FunctionLike
 /**
  * @param Function_|ClassMethod $node
  */
 function importReturnValue($node)
 {
     $comment = $node->getDocComment();
     if ($comment) {
         $str = $comment->getText();
         try {
             $docBlock = $this->factory->create($str, $this->getDocBlockContext());
             $return = $docBlock->getTagsByName("return");
             if (count($return)) {
                 $returnType = $return[0]->getType();
                 $types = explode("|", $returnType);
                 if (count($types) > 1) {
                     $node->setAttribute("namespacedReturn", \Guardrail\Scope::MIXED_TYPE);
                 } else {
                     foreach ($types as $type) {
                         if ($type[0] == '\\') {
                             $type = substr($type, 1);
                         }
                         $node->setAttribute("namespacedReturn", strval($type));
                         return;
                     }
                 }
             }
         } catch (\InvalidArgumentException $e) {
             // Skip it.
         }
     }
 }
 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();
 }
 public function store_function(Node\Stmt\Function_ $function)
 {
     $parameters = array_map(function ($param) {
         return array('name' => $param->name, 'default' => !empty($param->default), 'type' => ltrim((string) $param->type, '\\'));
     }, $function->getParams());
     $description = '';
     $return_types = array();
     if ($comments = $function->getAttribute('comments')) {
         $phpdoc = new DocBlock($comments[0]->getText());
         $description = $phpdoc->getShortDescription();
         if ($return = $phpdoc->getTagsByName('return')) {
             $return_types = array_map('ltrim', explode('|', $return[0]->getType()), array('\\'));
         }
         // short circuit @ignore functions
         if ($phpdoc->hasTag('ignore')) {
             return;
         }
     }
     $this->store_model('functions', array('function' => $function->name, 'namespace' => !empty($function->namespacedName) ? implode('\\', array_slice($function->namespacedName->parts, 0, -1)) : '', 'file' => $this->_current_file, 'line' => $function->getLine(), 'description' => $description, 'return_types' => json_encode($return_types), 'parameters' => json_encode($parameters)));
 }
 /**
  * @param Node\Stmt\Function_ $node
  */
 protected function parseFunctionNode(Node\Stmt\Function_ $node)
 {
     $parameters = [];
     /** @var \PhpParser\Node\Param $param */
     foreach ($node->params as $param) {
         $parameters[] = ['name' => $param->name, 'type' => (string) $param->type, 'isReference' => $param->byRef, 'isVariadic' => $param->variadic, 'isOptional' => $param->default ? true : false];
     }
     $this->globalFunctions[] = ['name' => $node->name, 'startLine' => $node->getLine(), 'returnType' => $node->getReturnType(), 'parameters' => $parameters, 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null];
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->functionAfter->getLine();
 }
 /**
  * Get the line number that this function ends on.
  *
  * @return int
  */
 public function getEndLine()
 {
     return (int) $this->node->getAttribute('endLine', -1);
 }
 public function addFunction(FunctionNode $node)
 {
     $function = new ReflectionFunction((string) $node->namespacedName);
     $function->setFilename((string) $this->context->getFilePath());
     $function->setStartLine((int) $node->getAttribute('startLine'));
     $function->setEndLine((int) $node->getAttribute('endLine'));
     $function->setAliases($this->context->getAliases());
     $function->setDocComment((string) $node->getDocComment());
     $this->addFunctionLikeParameters($function, $node->params);
     $this->context->enterReflection($function);
     $this->context->enterFunctionLike($function);
     return $function;
 }
 /**
  * @return int
  */
 public function getLine()
 {
     return $this->functionBefore->getLine();
 }