-
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
Squiz.WhiteSpace.ScopeKeywordSpacing does not report tabs after "private" #3901
Comments
@Daimona Thanks for the report. This is however not a false positive as tabs vs spaces is not the concern of this sniff. When you use inline tabs, the size of the tab is determined by the context and the In your case, I presume you have this set to That would result (correctly) in:
While if you would set the
If you want to forbid tabs for anything but indentation, I suggest you add a sniff to that effect to your ruleset. The PHPCSExtra package, for instance, has the I suggest closing this issue. |
Oh, sorry, I understand now. I thought "single space" meant "exactly one space (U+0020) character", but indeed, that was a bad assumption on my end.
I did not set that explicitly, but I just realized that the wrapper I was using to test this did that internally. Sorry about that!
I'll look into that, thank you! |
Describe the bug
The Squiz.WhiteSpace.ScopeKeywordSpacing is used to enforce a single space after scope keywords, which include visibility modifiers on method. While the sniff correctly emits an issue if the
public
keyword is followed by a tab, it doesn't do that for theprivate
keyword. Judging from the error message, it looks like the sniff might be computing the length of the spacing, instead of checking the characters.Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php
Expected behavior
PHPCS should emit an error for the getPrivateFoo function, similar to the one emitted for getPublicFoo.
Versions (please complete the following information)
Please confirm:
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: