Skip to content

Commit

Permalink
Update phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed May 27, 2024
1 parent 81b121b commit 09e616f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/Composer/Json/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function format(string $json, bool $unescapeUnicode, bool $unescap

if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
// https://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha
$buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', static function ($match) {
$buffer = Preg::replaceCallback('/(\\\\+)u([0-9a-f]{4})/i', static function ($match): string {
assert(is_string($match[1]));
assert(is_string($match[2]));
$l = strlen($match[1]);
Expand All @@ -77,7 +77,7 @@ public static function format(string $json, bool $unescapeUnicode, bool $unescap
// 0xD800..0xDFFF denotes UTF-16 surrogate pair which won't be unescaped
// see https://github.com/composer/composer/issues/7510
if (0xD800 <= $code && 0xDFFF >= $code) {
return $match[0];
return (string) $match[0];
}

return str_repeat('\\', $l - 1) . mb_convert_encoding(
Expand All @@ -87,7 +87,7 @@ public static function format(string $json, bool $unescapeUnicode, bool $unescap
);
}

return $match[0];
return (string) $match[0];
}, $buffer);
}

Expand Down

0 comments on commit 09e616f

Please sign in to comment.