Commit aa00185
committed
Ruleset::processRule(): fix edge case bug - inconsistent handling of empty string array key
Unlikely scenario for real-life, but still a bug.
When an array property is set via the old comma-separated string ruleset format or via an inline `phpcs:set` annotation, and the key for an array element would be explicitly set to an empty string, the resulting array item in the property on the sniff class would be added without a key, resulting in a numeric key.
However, if the (not so) "new" ruleset format using `<element>` nodes is used and an array element key is an empty string, this would result in the array item being added with an empty string for the array key.
This is inconsistent behaviour and is now fixed.
As 2 out of 3 scenarios would result in a numeric key, the behaviour has now been standardized as such. This can be revisited, if needs be, at a later point in time.1 parent e38b254 commit aa00185
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
1218 | | - | |
| 1218 | + | |
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
| |||
0 commit comments