Skip to content

[Scripts] Add list-non-composer-based-rules.php script - #8276

Merged
TomasVotruba merged 5 commits into
mainfrom
list-non-composer-based-rules-script
Aug 3, 2026
Merged

[Scripts] Add list-non-composer-based-rules.php script#8276
TomasVotruba merged 5 commits into
mainfrom
list-non-composer-based-rules-script

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Two changes to the rule-listing scripts.

1. scripts/list-unused-rules.php — skip deprecated rules

RectorClassFinder already skipped rules implementing DeprecatedInterface. Now it also skips rules deprecated via docblock or attribute only:

/**
 * @deprecated as it worsens readability...
 */
final class SomeRector extends AbstractRector
#[Deprecated]
final class SomeRector extends AbstractRector

2. New scripts/list-non-composer-based-rules.php

Lists rules from core, doctrine, phpunit and symfony that are not registered in any composer-based.php set — these are candidates for dead rules, as they are not bound to the installed package version.

Output:

Found Rector 763 rules
Found 4 composer-based sets
 * config/set/nette-utils/composer-based.php
 * vendor/rector/rector-symfony/config/sets/symfony/composer-based.php
 * vendor/rector/rector-doctrine/config/sets/composer-based.php
 * vendor/rector/rector-phpunit/config/sets/composer-based.php

Found 68 Rector rules used in composer-based sets

 * Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector
 ...
 * Rector\Symfony\Symfony25\Rector\MethodCall\MaxLengthSymfonyFormOptionToAttrRector

Found 695 Rector rules not in any composer-based set, likely dead

The UsedRectorClassResolver class was moved out of list-unused-rules.php into scripts/src/Resolver/, so both scripts share it.

@TomasVotruba
TomasVotruba force-pushed the list-non-composer-based-rules-script branch 3 times, most recently from 3e65e6f to 7462b26 Compare August 3, 2026 16:54
@TomasVotruba
TomasVotruba force-pushed the list-non-composer-based-rules-script branch from 7462b26 to b48a514 Compare August 3, 2026 17:14
@TomasVotruba
TomasVotruba merged commit 40943e4 into main Aug 3, 2026
64 checks passed
@TomasVotruba
TomasVotruba deleted the list-non-composer-based-rules-script branch August 3, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant