Example #1
0
 /**
  * This method parses a PHP 5.3 closure or lambda function.
  *
  * @return \PDepend\Source\AST\ASTClosure
  * @since  0.9.5
  */
 private function parseClosureDeclaration()
 {
     $this->tokenStack->push();
     if (Tokens::T_FUNCTION === $this->tokenizer->peek()) {
         $this->consumeToken(Tokens::T_FUNCTION);
     }
     $closure = $this->builder->buildAstClosure();
     $closure->setReturnsByReference($this->parseOptionalByReference());
     $closure->addChild($this->parseFormalParameters());
     $closure = $this->parseOptionalBoundVariables($closure);
     $closure->addChild($this->parseScope());
     return $this->setNodePositionsAndReturn($closure);
 }