public static function expectedToken(
        $expected,
        array $token = null,
        DocLexer $lexer = null
    ) {
        if ((null === $token) && $lexer) {
            $token = $lexer->lookahead;
        }

        $message = "Expected $expected, received ";

        if ($token) {
            $message .= "'{$token['value']}' at position {$token['position']}.";
        } else {
            $message .= 'end of string.';
        }

        return new self($message);
    }
public static function expectedToken(
        $expected,
        array $token = null,
        DocLexer $lexer = null
    ) {
        if ((null === $token) && $lexer) {
            $token = $lexer->lookahead;
        }

        $message = "Expected $expected, received ";

        if ($token) {
            $message .= "'{$token['value']}' at position {$token['position']}.";
        } else {
            $message .= 'end of string.';
        }

        return new self($message);
    }
public static function expectedToken ( $ expected , array $ token = null , DocLexer $ lexer = null ) { if ( ( null === $ token ) && $ lexer ) { $ token = $ lexer -> lookahead ; } $ message = "Expected $expected, received " ; if ( $ token ) { $ message .= "'{$token['value']}' at position {$token['position']}." ; } else { $ message .= 'end of string.' ; } return new self ( $ message ) ; }
Creates a new exception for the expected token.

@param string   $expected The expected token.
@param array    $token    The actual token.
@param DocLexer $lexer    The lexer.

@return SyntaxException The new exception.
Creates a new exception for the expected token .