From d7d063b242b8dd027ccace6699992211d02087db Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Sat, 24 Jan 2026 10:58:12 -0300 Subject: [PATCH 1/2] fix(style): Add `phpdoc_param_order` rule and update namespace references in `rector.php`. --- .styleci.yml | 1 + rector.php | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) 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, ], ); }; From ce7d538110b9b0b0018f9c7d28a4953021d9eb1a Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Sat, 24 Jan 2026 11:17:14 -0300 Subject: [PATCH 2/2] fix(formatting): Apply rector rules. --- src/Fallback/ComposerFallback.php | 4 +--- src/Json/JsonFormatter.php | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) 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) {