-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
phpcs:ignore usage unclear #2157
Comments
The PHPCS annotations are documented quite extensively in the wiki: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file
Does that answer your question ? |
Again, you can selectively ignore one or more specific error message codes, sniffs, categories of sniffs, or entire standards. Does this still applies to one single line? |
All of these can be combined with (parts of) sniff codes and those, in that case, will be applied only for the parts of the file the
Does that clarify it ? |
yes (I asked because I didn't find that particular case in the documentation) |
No, it will not. It will literally skip the line it is on and the next line - not the next line of real PHP. So, this will not work as expected: // phpcs:ignore someSpecificSniff -- This will ignore the annotation line below for someSpecificSniff.
// phpcs:ignore someOtherSniff -- This will ignore the code line below for someOtherSniff.
myBadCode('partly', true); However, this will work: // phpcs:ignore someSpecificSniff,someOtherSniff -- Skipping the next line for both sniffs.
myBadCode('partly', true); |
clear enough, thanks for the explanation |
The documentation only mentioned the way is is set,
but what I miss, is:
is it set only for that file, or method, or next line?
and how is it unset?
The text was updated successfully, but these errors were encountered: