src/Behat/Gherkin/Parser.php
protected function expectTokenType($type)
    {
        $types = (array) $type;
        if (in_array($this->predictTokenType(), $types)) {
            return $this->lexer->getAdvancedToken();
        }

        $token = $this->lexer->predictToken();

        throw new ParserException(sprintf(
            'Expected %s token, but got %s on line: %d%s',
            implode(' or ', $types),
            $this->predictTokenType(),
            $token['line'],
            $this->file ? ' in file: ' . $this->file : ''
        ));
    }
protected function expectTokenType($type)
    {
        $types = (array) $type;
        if (in_array($this->predictTokenType(), $types)) {
            return $this->lexer->getAdvancedToken();
        }

        $token = $this->lexer->predictToken();

        throw new ParserException(sprintf(
            'Expected %s token, but got %s on line: %d%s',
            implode(' or ', $types),
            $this->predictTokenType(),
            $token['line'],
            $this->file ? ' in file: ' . $this->file : ''
        ));
    }
protected function expectTokenType ( $ type ) { $ types = ( array ) $ type ; if ( in_array ( $ this -> predictTokenType ( ) , $ types ) ) { return $ this -> lexer -> getAdvancedToken ( ) ; } $ token = $ this -> lexer -> predictToken ( ) ; throw new ParserException ( sprintf ( 'Expected %s token, but got %s on line: %d%s' , implode ( ' or ' , $ types ) , $ this -> predictTokenType ( ) , $ token [ 'line' ] , $ this -> file ? ' in file: ' . $ this -> file : '' ) ) ; }
Returns next token if it's type equals to expected.

@param string $type Token type

@return array

@throws Exception\ParserException
Returns next token if it s type equals to expected .