Support Question : Ability to exclude one rule from a set ?
Hi,
Is it possible to exclude one rule from a set in a PHP configuration ?
I've found sample with old yaml configuration ... You can use a whole ruleset, except one rule:
rector.yaml
parameters: exclude_rectors: - 'Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector'__ ...
How can I do the same goal in a PHP configuration ? I try to use this kind of snipplet
rector.php
... $parameters->set(Option::SETS, [ SetList::PHP_52 ]); $parameters->set(Option::SKIP, [VarToPublicPropertyRector::class,]); ... but it does not work
https://github.com/rectorphp/rector/issues/4744
tl;dr; try to use Option::EXCLUDE_RECTORS
@lulco :+1: Thank you
Thanks,
Note : the constant Option::EXCLUDE_RECTORS currently does not exist in the component Rector\Core\Configuration\Option in master branch.
FYI the rector API has changed again over the years. This is the new way to skip rules from sets:
$rectorConfig->sets([LevelSetList::UP_TO_PHP_81]);
$rectorConfig->skip([
// currently ignores and deletes symfony annotations for ORM
ClassPropertyAssignToConstructorPromotionRector::class,
// violates ecs
MixedTypeRector::class,
// diff is too big, wait for PHP 8.3 readonly classes
ReadOnlyPropertyRector::class,
]);
This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.