Ejemplo n.º 1
0
 /**
  * This method will parse a variable declarator.
  *
  * <code>
  * // Parameter declarator
  * function foo($x = 23) {
  * }
  * // Property declarator
  * class Foo{
  *     protected $bar = 42;
  * }
  * // Static declarator
  * function baz() {
  *     static $foo;
  * }
  * </code>
  *
  * @return \PDepend\Source\AST\ASTVariableDeclarator
  * @since  0.9.6
  */
 private function parseVariableDeclarator()
 {
     $this->tokenStack->push();
     $name = $this->consumeToken(Tokens::T_VARIABLE)->image;
     $this->consumeComments();
     $declarator = $this->builder->buildAstVariableDeclarator($name);
     if ($this->tokenizer->peek() === Tokens::T_EQUAL) {
         $this->consumeToken(Tokens::T_EQUAL);
         $declarator->setValue($this->parseStaticValueOrStaticArray());
     }
     return $this->setNodePositionsAndReturn($declarator);
 }