Skip to content

Commit 3464591

Browse files
committed
Don't pass null as parameter
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 7736429 commit 3464591

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Doctrine/ORM/Query/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)