Ruleset: bug fix - correctly handle empty array property setting #865
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.
Description
While already handled correctly for inline properties set via
phpcs:set
, setting a property to an empty array from a ruleset file was not handled correctly until now.As things were, when setting an array property from the ruleset to an empty array like so:
the property value would be set to:
... while the expected behaviour would be:
While it is not expected that this type of property setting is encountered a lot in the wild, it should still work correctly.
Fixed now.
Includes test safeguarding the fix.
Suggested changelog entry
Setting an array property to an empty array from an XML ruleset now works correctly.
Previously, the property value would be set to
[0 => '']
.Types of changes