Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "--only" option to process only a single rule #6441

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 15, 2024

  1. Add "--only" option to process only a single rule

    The option for the "process" and "list-rules" commands applies
    the single given rule only, without needing to modify
    the configuration file.
    
    The option value must be a fully classified class name:
    
      --only="Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector"
    
    A hint is given when the user forgot to escape the backslashes.
    
    ----
    
    It is impossible to modify the injected "$rectors" after the
    command line configuration is parsed, so I had to introduce the
    ConfigurationRuleFilter singleton.
    
    Since both ListRulesCommand and ProcessCommand make use of the
    ConfigurationRuleFilter - but list-rules does not have a Configuration -
    I had to make the filterOnlyRule() method public to prevent
    code duplication.
    
    Resolves rectorphp/rector#8899
    cweiske committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    e5b3888 View commit details
    Browse the repository at this point in the history