Behat\Gherkin\Parser::expectTokenType PHP Method

expectTokenType() protected method

Returns next token if it's type equals to expected.
protected expectTokenType ( string $type ) : array
$type string Token type
return array
    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 : ''));
    }