Skip to content

Commit bcc7015

Browse files
committed
Remove dead SetManager and setGroups plumbing
With set providers gone, group matching always yielded nothing. Drop SetManager, the setGroups/groupLoadedSets fields and the composer-based set-group fallback; withComposerBased() now only loads defined set-list constants. Claude-Session: https://claude.ai/code/session_015hE4UdetizXAUwE7JKZHX7
1 parent b6ceb1f commit bcc7015

3 files changed

Lines changed: 3 additions & 55 deletions

File tree

‎src/Configuration/RectorConfigBuilder.php‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Rector\Php\PhpVersionResolver\ComposerJsonPhpVersionResolver;
2626
use Rector\PHPUnit\Set\PHPUnitSetList;
2727
use Rector\Set\Enum\SetGroup;
28-
use Rector\Set\SetManager;
2928
use Rector\Set\ValueObject\DowngradeLevelSetList;
3029
use Rector\Set\ValueObject\SetList;
3130
use Rector\Symfony\Set\SymfonyInternalSetList;
@@ -172,20 +171,10 @@ final class RectorConfigBuilder
172171
*/
173172
private array $registerServices = [];
174173

175-
/**
176-
* @var array<SetGroup::*>
177-
*/
178-
private array $setGroups = [];
179-
180174
private ?bool $reportingRealPath = null;
181175

182176
private ?bool $reportUnusedSkips = null;
183177

184-
/**
185-
* @var string[]
186-
*/
187-
private array $groupLoadedSets = [];
188-
189178
private ?string $editorUrl = null;
190179

191180
private ?bool $isWithPhpSetsUsed = null;
@@ -201,14 +190,6 @@ final class RectorConfigBuilder
201190

202191
public function __invoke(RectorConfig $rectorConfig): void
203192
{
204-
if ($this->setGroups !== []) {
205-
$setManager = new SetManager();
206-
207-
$this->groupLoadedSets = $setManager->matchBySetGroups();
208-
209-
SimpleParameterProvider::addParameter(Option::COMPOSER_BASED_SETS, $this->groupLoadedSets);
210-
}
211-
212193
// not to miss it by accident
213194
if ($this->isWithPhpSetsUsed === true) {
214195
$this->sets[] = SetList::PHP_POLYFILLS;
@@ -221,9 +202,6 @@ public function __invoke(RectorConfig $rectorConfig): void
221202
);
222203
}
223204

224-
// merge sets together
225-
$this->sets = array_merge($this->sets, $this->groupLoadedSets);
226-
227205
$uniqueSets = array_unique($this->sets);
228206

229207
if ($this->isWithPhpLevelUsed && $this->isWithPhpSetsUsed) {
@@ -732,12 +710,7 @@ public function withComposerBased(
732710

733711
// single set, as every rule inside is bound to the installed package version on its own
734712
$this->sets[] = $setFilePath;
735-
continue;
736713
}
737-
738-
// @deprecated fallback for extensions that still describe their sets as objects,
739-
// instead of bonding the rules themselves
740-
$this->setGroups[] = $setGroup;
741714
}
742715

743716
if ($phpunit) {

‎src/Set/SetManager.php‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎tests/Configuration/ExtensionComposerBasedSetTest.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function testEverySetGroupToggleHasASetListMapped(): void
2828
}
2929

3030
/**
31-
* The extension packages are not required by rector-src, so their constant is undefined here and the
32-
* deprecated set group has to keep working.
31+
* The extension packages are not required by rector-src, so their constant is undefined here and
32+
* nothing is loaded for the toggle.
3333
*/
34-
public function testFallsBackToTheSetGroupWhenTheExtensionIsNotInstalled(): void
34+
public function testLoadsNothingWhenTheExtensionIsNotInstalled(): void
3535
{
3636
foreach ($this->provideExtensionComposerBasedSetLists() as $setListConstant) {
3737
$this->assertFalse(defined($setListConstant), $setListConstant);
@@ -40,7 +40,6 @@ public function testFallsBackToTheSetGroupWhenTheExtensionIsNotInstalled(): void
4040
$rectorConfigBuilder = new RectorConfigBuilder()
4141
->withComposerBased(laravel: true, drupal: true);
4242

43-
$this->assertSame([SetGroup::LARAVEL, SetGroup::DRUPAL], $this->readPrivateArray($rectorConfigBuilder, 'setGroups'));
4443
$this->assertSame([], $this->readPrivateArray($rectorConfigBuilder, 'sets'));
4544
}
4645

0 commit comments

Comments
 (0)