Skip to content

Commit 290fd84

Browse files
committed
refactor(composer-updater, rector): Refactor dryRun and add new rector class
- Moved dryRun property to class constructor for better encapsulation - Updated condition check from empty() to strict array comparison - Added ChangeOrIfContinueToMultiContinueRector to Rector configuration - Specified ScalarValueToConstFetchRector for composer-updater directory
1 parent dae82c7 commit 290fd84

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

composer-updater

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ $status = (new SingleCommandApplication)
5757
private string $composerBinary;
5858
private array $exceptPackages;
5959
private array $exceptDependencyVersions;
60-
private bool $dryRun;
6160
private SymfonyStyle $symfonyStyle;
6261
private Differ $differ;
6362

@@ -70,7 +69,7 @@ $status = (new SingleCommandApplication)
7069
?string $composerBinary = null,
7170
array $exceptPackages = [],
7271
array $exceptDependencyVersions = [],
73-
bool $dryRun = false,
72+
private bool $dryRun = false,
7473
?SymfonyStyle $symfonyStyle = null,
7574
?Differ $differ = null
7675
) {
@@ -91,7 +90,6 @@ $status = (new SingleCommandApplication)
9190
'*@*',
9291
// '*|*',
9392
], $exceptDependencyVersions);
94-
$this->dryRun = $dryRun;
9593
$this->symfonyStyle = $symfonyStyle ?? new SymfonyStyle(new ArgvInput, new ConsoleOutput);
9694
$this->differ = $differ ?? new Differ;
9795
}
@@ -289,7 +287,7 @@ $status = (new SingleCommandApplication)
289287
{
290288
$patterns = (array) $pattern;
291289

292-
if (empty($patterns)) {
290+
if ([] === $patterns) {
293291
return false;
294292
}
295293

rector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector;
3535
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
3636
use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
37+
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
3738
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
3839
use Rector\PHPUnit\Set\PHPUnitSetList;
3940
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
@@ -175,6 +176,7 @@ static function (array $carry, string $func): array {
175176
)
176177
)
177178
->withSkip([
179+
ChangeOrIfContinueToMultiContinueRector::class,
178180
EncapsedStringsToSprintfRector::class,
179181
ExplicitBoolCompareRector::class,
180182
LogicalToBooleanRector::class,
@@ -210,6 +212,9 @@ static function (array $carry, string $func): array {
210212
ToInternalExceptionRector::class => [
211213
__DIR__.'/tests',
212214
],
215+
ScalarValueToConstFetchRector::class => [
216+
__DIR__.'/composer-updater',
217+
],
213218
StaticArrowFunctionRector::class => $staticClosureSkipPaths = [
214219
__DIR__.'/tests',
215220
],

0 commit comments

Comments
 (0)