Skip to content

Commit 34fbd45

Browse files
fix(style): Add phpdoc_param_order rule and update namespace references in rector.php. (#118)
1 parent 9151b2c commit 34fbd45

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ enabled:
5555
- phpdoc_no_empty_return
5656
- phpdoc_no_useless_inheritdoc
5757
- phpdoc_order
58+
- phpdoc_param_order
5859
- phpdoc_property
5960
- phpdoc_scalar
6061
- phpdoc_singular_inheritdoc

rector.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
return static function (Rector\Config\RectorConfig $rectorConfig): void {
5+
return static function (\Rector\Config\RectorConfig $rectorConfig): void {
66
$rectorConfig->parallel();
77

88
$rectorConfig->importNames();
@@ -16,21 +16,21 @@
1616

1717
$rectorConfig->sets(
1818
[
19-
Rector\Set\ValueObject\SetList::PHP_81,
20-
Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81,
21-
Rector\Set\ValueObject\SetList::TYPE_DECLARATION,
19+
\Rector\Set\ValueObject\SetList::PHP_81,
20+
\Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_81,
21+
\Rector\Set\ValueObject\SetList::TYPE_DECLARATION,
2222
],
2323
);
2424

2525
$rectorConfig->skip(
2626
[
27-
Rector\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector::class,
27+
\Rector\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector::class,
2828
],
2929
);
3030

3131
$rectorConfig->rules(
3232
[
33-
Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector::class,
33+
\Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector::class,
3434
],
3535
);
3636
};

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)