Skip to content

Commit 37e6329

Browse files
committed
refactor: skip CompactToVariablesRector
1 parent 21b8877 commit 37e6329

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
1818
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
1919
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
20+
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
2021
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
2122
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
2223
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
@@ -171,6 +172,8 @@
171172

172173
// Unnecessary (string) is inserted
173174
NullToStrictStringFuncCallArgRector::class,
175+
176+
CompactToVariablesRector::class,
174177
])
175178
// auto import fully qualified class names
176179
->withImportNames(removeUnusedImports: true)

system/Commands/Generators/ModelGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ protected function prepare(string $class): string
130130
$return = "'{$return}'";
131131
}
132132

133-
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], ['dbGroup' => $dbGroup]);
133+
return $this->parseTemplate($class, ['{dbGroup}', '{table}', '{return}'], [$dbGroup, $table, $return], compact('dbGroup'));
134134
}
135135
}

system/Commands/Translation/LocalizationFinder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private function findTranslationsInFile($file): array
195195
preg_match_all('/lang\(\'([._a-z0-9\-]+)\'\)/ui', $fileContent, $matches);
196196

197197
if ($matches[1] === []) {
198-
return ['foundLanguageKeys' => $foundLanguageKeys, 'badLanguageKeys' => $badLanguageKeys];
198+
return compact('foundLanguageKeys', 'badLanguageKeys');
199199
}
200200

201201
foreach ($matches[1] as $phraseKey) {
@@ -228,7 +228,7 @@ private function findTranslationsInFile($file): array
228228
}
229229
}
230230

231-
return ['foundLanguageKeys' => $foundLanguageKeys, 'badLanguageKeys' => $badLanguageKeys];
231+
return compact('foundLanguageKeys', 'badLanguageKeys');
232232
}
233233

234234
private function isIgnoredFile(SplFileInfo $file): bool
@@ -384,6 +384,6 @@ private function findLanguageKeysInFiles(array $files): array
384384
$badLanguageKeys = array_merge($findInFile['badLanguageKeys'], $badLanguageKeys);
385385
}
386386

387-
return ['foundLanguageKeys' => $foundLanguageKeys, 'badLanguageKeys' => $badLanguageKeys, 'countFiles' => $countFiles];
387+
return compact('foundLanguageKeys', 'badLanguageKeys', 'countFiles');
388388
}
389389
}

system/Test/Fabricator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function setOverrides(array $overrides = [], $persist = true): self
272272
*/
273273
public function setUnique(string $field, bool $reset = false, int $maxRetries = 10000): static
274274
{
275-
$this->modifiedFields['unique'][$field] = ['reset' => $reset, 'maxRetries' => $maxRetries];
275+
$this->modifiedFields['unique'][$field] = compact('reset', 'maxRetries');
276276

277277
return $this;
278278
}
@@ -284,7 +284,7 @@ public function setUnique(string $field, bool $reset = false, int $maxRetries =
284284
*/
285285
public function setOptional(string $field, float $weight = 0.5, mixed $default = null): static
286286
{
287-
$this->modifiedFields['optional'][$field] = ['weight' => $weight, 'default' => $default];
287+
$this->modifiedFields['optional'][$field] = compact('weight', 'default');
288288

289289
return $this;
290290
}
@@ -298,7 +298,7 @@ public function setOptional(string $field, float $weight = 0.5, mixed $default =
298298
*/
299299
public function setValid(string $field, ?Closure $validator = null, int $maxRetries = 10000): static
300300
{
301-
$this->modifiedFields['valid'][$field] = ['validator' => $validator, 'maxRetries' => $maxRetries];
301+
$this->modifiedFields['valid'][$field] = compact('validator', 'maxRetries');
302302

303303
return $this;
304304
}

0 commit comments

Comments
 (0)