Skip to content

Commit b48a514

Browse files
committed
[Scripts] Skip typed-collections set rules in list-non-composer-based-rules.php
1 parent a760c77 commit b48a514

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎scripts/list-non-composer-based-rules.php‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,21 @@
4747
sprintf('<fg=yellow>Found %d Rector rules used in composer-based sets</>', count($usedRectorRules))
4848
);
4949

50-
// code-quality rules are not bound to any package version, so they never belong to a composer-based set
51-
$codeQualitySetFiles = array_filter(
52-
$rectorSetFiles,
53-
static fn (string $rectorSetFile): bool => str_ends_with(basename($rectorSetFile), 'code-quality.php')
54-
);
50+
// these rules are not bound to any package version, so they never belong to a composer-based set
51+
$versionAgnosticSetFileNames = ['code-quality.php', 'typed-collections.php', 'typed-collections-docblocks.php'];
52+
53+
$versionAgnosticSetFiles = array_filter($rectorSetFiles, static fn (string $rectorSetFile): bool => array_any($versionAgnosticSetFileNames, fn (string $versionAgnosticSetFileName): bool => str_ends_with(basename($rectorSetFile), $versionAgnosticSetFileName)));
5554

56-
$codeQualityRectorRules = $usedRectorClassResolver->resolve($codeQualitySetFiles);
55+
$versionAgnosticRectorRules = $usedRectorClassResolver->resolve($versionAgnosticSetFiles);
5756

5857
$symfonyStyle->writeln(
59-
sprintf('<fg=yellow>Found %d Rector rules used in code-quality sets</>', count($codeQualityRectorRules))
58+
sprintf(
59+
'<fg=yellow>Found %d Rector rules used in version-agnostic sets</>',
60+
count($versionAgnosticRectorRules)
61+
)
6062
);
6163

62-
$nonComposerBasedRectorRules = array_diff($rectorClasses, $usedRectorRules, $codeQualityRectorRules);
64+
$nonComposerBasedRectorRules = array_diff($rectorClasses, $usedRectorRules, $versionAgnosticRectorRules);
6365

6466
$symfonyStyle->newLine();
6567
$symfonyStyle->listing($nonComposerBasedRectorRules);

‎src/Configuration/RectorConfigBuilder.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,11 @@ public function withComposerBased(
755755
}
756756

757757
if ($doctrine) {
758-
$this->sets[] = DoctrineSetList::COMPOSER_BASED;
758+
// $this->sets[] = DoctrineSetList::COMPOSER_BASED;
759759
}
760760

761761
if ($twig) {
762-
$this->sets[] = \Rector\Symfony\Set\TwigSetList::COMPOSER_BASED;
762+
// $this->sets[] = TwigSetList::COMPOSER_BASED;
763763
}
764764

765765
if ($symfony) {

0 commit comments

Comments
 (0)