Universal/CommaSpacing: improve handling of comma spacing within PHP attributes #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While the
Universal.WhiteSpace.CommaSpacingsniff would previously already flag spacing around commas in PHP attributes, this commit adds some special handling for this.This commit makes the following changes:
This is a parse error, but more importantly, we want to avoid conflicts with "bracket spacing" sniffs, so leave the spacing after an attribute opener to a "bracket spacing" sniff (like the new
Universal.Attributes.BracketSpacingsniff as introduced via PR ✨ NewUniversal.Attributes.BracketSpacingsniff #406).Trailing commas are allowed in PHP attributes, but more importantly, we want to avoid conflicts with "bracket spacing" sniffs, so bow out.
This allows for more modularly including/excluding errors specific to comma spacing for commas in attribute blocks.
Note: only commas between attributes in an attribute block will now use the
InAttributeBlocksuffix.Commas used to separate parameters passed to an attribute instantiation will still be flagged with the
InFunctionCallsuffix, same as before.Includes tests.
Fixes #391