diff --git a/.styleci.yml b/.styleci.yml index 6cf29b2..40c1c55 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -55,6 +55,7 @@ enabled: - phpdoc_no_empty_return - phpdoc_no_useless_inheritdoc - phpdoc_order + - phpdoc_param_order - phpdoc_property - phpdoc_scalar - phpdoc_singular_inheritdoc diff --git a/rector.php b/rector.php index c8db3d7..25d1066 100644 --- a/rector.php +++ b/rector.php @@ -2,7 +2,7 @@ declare(strict_types=1); -return static function (Rector\Config\RectorConfig $rectorConfig): void { +return static function (\Rector\Config\RectorConfig $rectorConfig): void { $rectorConfig->parallel(); $rectorConfig->importNames(); @@ -16,21 +16,21 @@ $rectorConfig->sets( [ - Rector\Set\ValueObject\SetList::PHP_81, - Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81, - Rector\Set\ValueObject\SetList::TYPE_DECLARATION, + \Rector\Set\ValueObject\SetList::PHP_81, + \Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81, + \Rector\Set\ValueObject\SetList::TYPE_DECLARATION, ], ); $rectorConfig->skip( [ - Rector\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector::class, + \Rector\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector::class, ], ); $rectorConfig->rules( [ - Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector::class, + \Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector::class, ], ); }; diff --git a/src/Fallback/ComposerFallback.php b/src/Fallback/ComposerFallback.php index c1a9960..2e1e310 100644 --- a/src/Fallback/ComposerFallback.php +++ b/src/Fallback/ComposerFallback.php @@ -142,9 +142,7 @@ private function restorePreviousLockFile(): void [$preferSource, $preferDist] = ConsoleUtil::getPreferredInstallOptions($config, $this->input); - $isOptionTrue = static function (mixed $value): bool { - return $value === true || $value === 1 || $value === '1'; - }; + $isOptionTrue = (static fn(mixed $value): bool => $value === true || $value === 1 || $value === '1'); $optimize = $isOptionTrue($this->input->getOption('optimize-autoloader')) || $isOptionTrue($config->get('optimize-autoloader')); diff --git a/src/Json/JsonFormatter.php b/src/Json/JsonFormatter.php index 4fe5bc7..a860e80 100644 --- a/src/Json/JsonFormatter.php +++ b/src/Json/JsonFormatter.php @@ -105,17 +105,22 @@ private static function formatInternal(string $json, bool $unescapeUnicode, bool $array = json_decode($json, true, 512, JSON_THROW_ON_ERROR); if ($unescapeUnicode) { - array_walk_recursive($array, static function (mixed &$item): void { - if (is_string($item)) { - $item = preg_replace_callback( - '/\\\\u([0-9a-fA-F]{4})/', - static function (mixed $match): string { - return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); - }, - $item, - ); - } - }); + array_walk_recursive( + $array, + static function (mixed &$item): void { + if (is_string($item)) { + $item = preg_replace_callback( + '/\\\\u([0-9a-fA-F]{4})/', + static fn(mixed $match): string => mb_convert_encoding( + pack('H*', $match[1]), + 'UTF-8', + 'UCS-2BE', + ), + $item, + ); + } + }, + ); } if ($unescapeSlashes) {