src/Language/Parser.php
protected function expect($type)
    {
        if ($this->token->getType() !== $type) {
            throw new \Exception(sprintf('Expected %s, found %s', Token::typeToString($type), (string) $this->token));
        }

        $token = $this->token;
        $this->advance();
        return $token;
    }
protected function expect($type)
    {
        if ($this->token->getType() !== $type) {
            throw new \Exception(sprintf('Expected %s, found %s', Token::typeToString($type), (string) $this->token));
        }

        $token = $this->token;
        $this->advance();
        return $token;
    }
protected function expect ( $ type ) { if ( $ this -> token -> getType ( ) !== $ type ) { throw new \ Exception ( sprintf ( 'Expected %s, found %s' , Token :: typeToString ( $ type ) , ( string ) $ this -> token ) ) ; } $ token = $ this -> token ; $ this -> advance ( ) ; return $ token ; }
If the next token is of the given kind, return that token after advancing
the parser. Otherwise, do not change the parser state and return false.

@param int $type

@return \Fubhy\GraphQL\Language\Token

@throws \Exception
If the next token is of the given kind return that token after advancing the parser . Otherwise do not change the parser state and return false .