/** * This method will parse a static variable declaration. * * <code> * function foo() * { * // First declaration * static $foo; * // Second declaration * static $bar = array(); * // Third declaration * static $baz = array(), * $foobar = null, * $barbaz; * } * </code> * * @param \PDepend\Source\Tokenizer\Token $token Token with the "static" keyword. * @return \PDepend\Source\AST\ASTStaticVariableDeclaration * @since 0.9.6 */ private function parseStaticVariableDeclaration(Token $token) { $staticDeclaration = $this->builder->buildAstStaticVariableDeclaration($token->image); // Strip optional comments $this->consumeComments(); // Fetch next token type $tokenType = $this->tokenizer->peek(); while ($tokenType !== Tokenizer::T_EOF) { $staticDeclaration->addChild($this->parseVariableDeclarator()); $this->consumeComments(); // Semicolon terminates static declaration $tokenType = $this->tokenizer->peek(); if ($tokenType === Tokens::T_SEMICOLON) { break; } // We are here, so there must be a next declarator $this->consumeToken(Tokens::T_COMMA); } return $staticDeclaration; }