PHP_CodeSniffer
PHP_CodeSniffer copied to clipboard
Generic/IncrementDecrementSpacing: handle more situations
The Generic.WhiteSpace.IncrementDecrementSpacing sniff, so far, only handled incrementors/decrementors when they were directly before/after the variable they apply to.
This commit enhances the sniff to also allow for finding superfluous whitespace when incrementing/decrementing a property or an array item.
Includes unit tests.
Note: I've only made this change for PHP files as JS support will be dropped anyway, so it didn't feel like a good use of my time to work on that.