TokenStream.php
public function expect($type, $value = null, $message = null)
    {
        $token = $this->current;
        if (!$token->test($type, $value)) {
            throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor);
        }
        $this->next();
    }
public function expect($type, $value = null, $message = null)
    {
        $token = $this->current;
        if (!$token->test($type, $value)) {
            throw new SyntaxError(sprintf('%sUnexpected token "%s" of value "%s" ("%s" expected%s)', $message ? $message.'. ' : '', $token->type, $token->value, $type, $value ? sprintf(' with value "%s"', $value) : ''), $token->cursor);
        }
        $this->next();
    }
public function expect ( $ type , $ value = null , $ message = null ) { $ token = $ this -> current ; if ( ! $ token -> test ( $ type , $ value ) ) { throw new SyntaxError ( sprintf ( '%sUnexpected token "%s" of value "%s" ("%s" expected%s)' , $ message ? $ message . '. ' : '' , $ token -> type , $ token -> value , $ type , $ value ? sprintf ( ' with value "%s"' , $ value ) : '' ) , $ token -> cursor ) ; } $ this -> next ( ) ; }
Tests a token.

@param array|int   $type    The type to test
@param string|null $value   The token value
@param string|null $message The syntax error message
Tests a token .