Closed eclipxe13 closed 8 years ago
Seemed like a good idea and an easy sniff to create, so I've committed a sniff and it will be in the next release.
The sniff does checking and fixing for PHP and JS files. Include it n a ruleset using this tag:
<rule ref="Generic.Formatting.SpaceAfterNot" />
Or run only that check over your entire code base:
phpcs --standard=Generic --sniffs=Generic.Formatting.SpaceAfterNot /path/to/code
Or just fix that in the code base:
phpcbf --standard=Generic --sniffs=Generic.Formatting.SpaceAfterNot /path/to/code
Thanks for the suggestion.
Maybe it also makes sense to create another sniff that would enforce the opposite checking/fixing behavior?
I agree with @aik099, except that I think that it could have been done with a single sniff.
Something like Generic.Formatting.LogicalNotSpacing
with options spacesBefore
and spacesAfter
.
I know this is old as the world, but I can't seem to find it - has enforcing a space after the logical not operator been added perhaps? Thanks!
@mkarnicki As stated above, the Generic.Formatting.SpaceAfterNot
sniff does just that (enfore one space after the not operator).
Open PR #2233 will make the sniff configurable, so you would also be able to use it to, for instance, enforce no space after the not operator.
Ah, great. Thank you @jrfnl . I thought it sniffed that as bad style, and you're saying it's the exact opposite :'). That works for me!
@eclipxe13 Would you help me here? https://github.com/ikappas/vscode-phpcs/issues/178
Would you consider to add a Sniff for logic not operator followed by a space?
In FriendsOfPHP/PHP-CS-Fixer they use the fix logical_not_operators_with_successor_space
Also, other developers and projects like http://auraphp.com/contributing/#standards use this style
It would be great to have it on PHP_CodeSniffer (thanks for your great work!)