Skip to content

Commit

Permalink
Fix $matches error
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Aug 22, 2024
1 parent 2afec65 commit 8752839
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Parser/StringUnescaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\PhpDocParser\Parser;

use PHPStan\ShouldNotHappenException;
use function chr;
use function hexdec;
use function octdec;
Expand Down Expand Up @@ -56,6 +57,9 @@ static function ($matches) {
return chr((int) hexdec(substr($str, 1)));
}
if ($str[0] === 'u') {
if (!isset($matches[2])) {
throw new ShouldNotHappenException();
}
return self::codePointToUtf8((int) hexdec($matches[2]));
}

Expand Down

0 comments on commit 8752839

Please sign in to comment.