Skip to content

[config] Deprecate and remove @noRector annotation, as not reliable DX choice; use skip() method instead#3148

Merged
TomasVotruba merged 4 commits intomainfrom
tv-depre-no-rector
Dec 3, 2022
Merged

[config] Deprecate and remove @noRector annotation, as not reliable DX choice; use skip() method instead#3148
TomasVotruba merged 4 commits intomainfrom
tv-depre-no-rector

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Dec 3, 2022

This option was useful in the past, when Rector came with unreliable solutions and unknown types.

This was mostly caused by type-guessing from docblock in type declaration set. These rules are now removed, and are replaced by rules that work with reliable and safe strict types: https://twitter.com/rectorphp/status/1599001416718163968

Saying that, these should no be ingnored anymore and fixed the the rule instead.

  • It only works with FQN, which does not make sense in auto imported names
  • The rename class could break it as well
  • Docblocks are not much reliable 😕
  • Lack of attribute form also suggest, this is not needed feature.
  • It often hides a bug behind legal ignore
  • The better option is often to ignore a pattern per rule, that is better achieved via config:
$rectorConfig->skip([
        \Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class => [
            '*/Entity/*'  
        ],
]);

If you still need to ignore some other rule for non-fixable reason, use skip() method instead, to keep it visible 👍

Currently, the Rector reports places in the code where @noRector is still used, so you can avoid unwanted changes. But in mostly cases, the ignore will not be needed.

@TomasVotruba TomasVotruba changed the title tv depre no rector [config] Deprecated and remove @noRector annotation, as hiding context and hard to fit on exact line; use skip() method instead Dec 3, 2022
@TomasVotruba TomasVotruba changed the title [config] Deprecated and remove @noRector annotation, as hiding context and hard to fit on exact line; use skip() method instead [config] Deprecate and remove @noRector annotation, as not reliable DX choice; use skip() method instead Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant