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

consumeToken() protected method

This method will consume the next token in the token stream. It will throw an exception if the type of this token is not identical with $tokenType.
protected consumeToken ( integer $tokenType ) : PDepend\Source\Tokenizer\Token
$tokenType integer The next expected token type.
return PDepend\Source\Tokenizer\Token
    protected function consumeToken($tokenType)
    {
        switch ($this->tokenizer->peek()) {
            case $tokenType:
                return $this->tokenStack->add($this->tokenizer->next());
            case Tokenizer::T_EOF:
                throw new TokenStreamEndException($this->tokenizer);
        }
        $this->throwUnexpectedTokenException();
    }
AbstractPHPParser