-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
Fix T_ELSE immediately followed by T_COLON #277
Conversation
Curently else: throws two errors: 1) Space after opening control structure is required (the Coding Standards handbook doesn't say anything on this) 2) No space before opening parenthesis is prohibited (this is just wrong - there is no paranthesis on this line) This commit prevents the sniffer from throwing these two errors.
I prefer the space ( |
In this case shouldn't |
Yes, in my opinion. I always use the space there as well. |
OK, it can be changed easily, but let's hear from @westonruter first? |
There are 44 instances of @nyordanov could you add a new property to the sniff which would control the behavior for whether a space is required or not? |
…ol structure and T_COLON
…re_colon_check is actually WordPress_Sniffs_WhiteSpace_ControlStructureSpacingSniff::$space_before_colon_required
I've added When the property is set to |
The last snippet in the https://make.wordpress.org/core/handbook/coding-standards/php/#brace-style section has this documented with a space. I'd be happy to see |
@GaryJones it does now, see the tests in 5afd52c The default settings of the sniff require that there is |
👍 Good job :-) |
@nyordanov This is some quality code. 👍 One thing, however, is the naming of the
|
…required", "forbidden" or "optional"
Related #17. |
Fix T_ELSE immediately followed by T_COLON
Curently
else:
throws two errors:This pull request prevents the sniffer from throwing these two errors.
If my interpretation of 1. is considered correct, I could add a fixable error for
else :