Suppress fixer rules using @nofixer annotation #7932
anton-kotik
started this conversation in
Feature ideas
Replies: 1 comment
-
Hi @anton-kotik, thanks for detailed proposal! FYI: it was already discussed in #3871 and even there was an attempt to implement it in #7569 🙂. There's also #4512, so a lot of stuff to get familiar with 😅. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Idea
Suppression of any rule with an annotation:
/** @nofixer [fixer_rule_name] [Optional comment] */
/** @nofixer [ClassNameFixer] [Optional comment] */
The idea taken from the inspections suppression IDE feature aka
/** @noinspection */
comments.To suppress the rule, you need to add the
/** @nofixer */
annotation before the selected piece of code (entire file, class, method, property, or statement). For example, if you suppress a rule for a class, add the annotation before this class. When a rule is suppressed, php-cs-fixer doesn't fix this rule problem found in the specific piece of code.Example
UpperCamelCase looks similar to
@noinspection
style and also could be supported:Primitive implementation
We are using something like this code for implementing this feature in our projects (works only for the entire file suppression):
Beta Was this translation helpful? Give feedback.
All reactions