PDepend\Source\Language\PHP\AbstractPHPParser::parseFieldDeclaration PHP Method

parseFieldDeclaration() private method

Simple field declaration class Foo { protected $foo; } Field declaration with multiple properties class Foo { protected $foo = 23 $bar = 42, $baz = null; }
Since: 0.9.6
private parseFieldDeclaration ( ) : PDepend\Source\AST\ASTFieldDeclaration
return PDepend\Source\AST\ASTFieldDeclaration
    private function parseFieldDeclaration()
    {
        $declaration = $this->builder->buildAstFieldDeclaration();
        $declaration->setComment($this->docComment);
        $type = $this->parseFieldDeclarationType();
        if ($type !== null) {
            $declaration->addChild($type);
        }
        $this->consumeComments();
        $tokenType = $this->tokenizer->peek();
        while ($tokenType !== Tokenizer::T_EOF) {
            $declaration->addChild($this->parseVariableDeclarator());
            $this->consumeComments();
            $tokenType = $this->tokenizer->peek();
            if ($tokenType !== Tokens::T_COMMA) {
                break;
            }
            $this->consumeToken(Tokens::T_COMMA);
            $this->consumeComments();
            $tokenType = $this->tokenizer->peek();
        }
        $this->setNodePositionsAndReturn($declaration);
        $this->consumeToken(Tokens::T_SEMICOLON);
        return $declaration;
    }
AbstractPHPParser