Skip to content

Commit 8752839

Browse files
staabmondrejmirtes
authored andcommitted
Fix $matches error
1 parent 2afec65 commit 8752839

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Parser/StringUnescaper.php

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PHPStan\PhpDocParser\Parser;
44

5+
use PHPStan\ShouldNotHappenException;
56
use function chr;
67
use function hexdec;
78
use function octdec;
@@ -56,6 +57,9 @@ static function ($matches) {
5657
return chr((int) hexdec(substr($str, 1)));
5758
}
5859
if ($str[0] === 'u') {
60+
if (!isset($matches[2])) {
61+
throw new ShouldNotHappenException();
62+
}
5963
return self::codePointToUtf8((int) hexdec($matches[2]));
6064
}
6165

0 commit comments

Comments
 (0)