Exemplo n.º 1
0
 /**
  * @param \PDepend\Source\AST\AbstractASTCallable $callable
  * @return \PDepend\Source\AST\AbstractASTCallable
  */
 protected function parseCallableDeclarationAddition($callable)
 {
     $this->consumeComments();
     if (Tokens::T_COLON != $this->tokenizer->peek()) {
         return $callable;
     }
     $this->consumeToken(Tokens::T_COLON);
     $type = $this->parseReturnTypeHint();
     $callable->addChild($type);
     return $callable;
 }
Exemplo n.º 2
0
 /**
  * Parses a function or a method and adds it to the parent context node.
  *
  * @param  \PDepend\Source\AST\AbstractASTCallable $callable
  * @return void
  */
 private function parseCallableDeclaration(AbstractASTCallable $callable)
 {
     $callable->addChild($this->parseFormalParameters());
     $this->consumeComments();
     if ($this->tokenizer->peek() == Tokens::T_CURLY_BRACE_OPEN) {
         $callable->addChild($this->parseScope());
     } else {
         $this->consumeToken(Tokens::T_SEMICOLON);
     }
 }