Skip to content

Commit ce7d538

Browse files
committed
fix(formatting): Apply rector rules.
1 parent d7d063b commit ce7d538

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/Fallback/ComposerFallback.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ private function restorePreviousLockFile(): void
142142

143143
[$preferSource, $preferDist] = ConsoleUtil::getPreferredInstallOptions($config, $this->input);
144144

145-
$isOptionTrue = static function (mixed $value): bool {
146-
return $value === true || $value === 1 || $value === '1';
147-
};
145+
$isOptionTrue = (static fn(mixed $value): bool => $value === true || $value === 1 || $value === '1');
148146

149147
$optimize = $isOptionTrue($this->input->getOption('optimize-autoloader'))
150148
|| $isOptionTrue($config->get('optimize-autoloader'));

src/Json/JsonFormatter.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,22 @@ private static function formatInternal(string $json, bool $unescapeUnicode, bool
105105
$array = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
106106

107107
if ($unescapeUnicode) {
108-
array_walk_recursive($array, static function (mixed &$item): void {
109-
if (is_string($item)) {
110-
$item = preg_replace_callback(
111-
'/\\\\u([0-9a-fA-F]{4})/',
112-
static function (mixed $match): string {
113-
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
114-
},
115-
$item,
116-
);
117-
}
118-
});
108+
array_walk_recursive(
109+
$array,
110+
static function (mixed &$item): void {
111+
if (is_string($item)) {
112+
$item = preg_replace_callback(
113+
'/\\\\u([0-9a-fA-F]{4})/',
114+
static fn(mixed $match): string => mb_convert_encoding(
115+
pack('H*', $match[1]),
116+
'UTF-8',
117+
'UCS-2BE',
118+
),
119+
$item,
120+
);
121+
}
122+
},
123+
);
119124
}
120125

121126
if ($unescapeSlashes) {

0 commit comments

Comments
 (0)