@@ -511,7 +511,7 @@ public function syntaxError($expected = '', $token = null)
511511 $ message .= $ expected !== '' ? sprintf ('Expected %s, got ' , $ expected ) : 'Unexpected ' ;
512512 $ message .= $ this ->lexer ->lookahead === null ? 'end of string. ' : sprintf ("'%s' " , $ token ['value ' ]);
513513
514- throw QueryException::syntaxError ($ message , QueryException::dqlError ($ this ->query ->getDQL ()));
514+ throw QueryException::syntaxError ($ message , QueryException::dqlError ($ this ->query ->getDQL () ?? '' ));
515515 }
516516
517517 /**
@@ -528,7 +528,7 @@ public function syntaxError($expected = '', $token = null)
528528 public function semanticalError ($ message = '' , $ token = null )
529529 {
530530 if ($ token === null ) {
531- $ token = $ this ->lexer ->lookahead ?? ['position ' => null ];
531+ $ token = $ this ->lexer ->lookahead ?? ['position ' => 0 ];
532532 }
533533
534534 // Minimum exposed chars ahead of token
@@ -541,7 +541,7 @@ public function semanticalError($message = '', $token = null)
541541 $ pos = strpos ($ dql , ' ' , $ length > $ pos ? $ pos : $ length );
542542 $ length = $ pos !== false ? $ pos - $ token ['position ' ] : $ distance ;
543543
544- $ tokenPos = isset ( $ token [ ' position ' ]) && $ token ['position ' ] > 0 ? $ token ['position ' ] : '-1 ' ;
544+ $ tokenPos = $ token ['position ' ] > 0 ? $ token ['position ' ] : '-1 ' ;
545545 $ tokenStr = substr ($ dql , $ token ['position ' ], $ length );
546546
547547 // Building informative message
0 commit comments