Skip to content

Commit 071aebe

Browse files
authored
PHPCS 4.0 Dev upgrade guide: document PHPCS PR 1193 (#48)
PHPCS PR 1193 makes a small change in how empty string array keys are handled in PHPCS 3.x (as numeric keys) and when this will be merged up into 4.x, an additional change will be made to respect empty string array keys. This commit documents this change in the Dev upgrade guide for 4.0. Co-authored-by: jrfnl <[email protected]>
1 parent e4a5af4 commit 071aebe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wiki/Version-4.0-Developer-Upgrade-Guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,17 @@ Type casting for sniff property values set from within a ruleset has been made m
118118
* `null` will now be set to an actual `null` value. Previously, the sniff property would have been set to string `'null'`.
119119
* Array element values will now also get the type casting treatment. Previously, array values would always be strings.
120120

121+
Note: Array element _keys_ will not get the type cast treatment.
122+
The only difference for the handling of array element _keys_ is, that an empty string array key would previously, unexpectedly, result in a numeric key. This has now been fixed and empty string array keys will be respected and result in an empty string array key on the sniff property.
123+
121124
**Upgrading**
122125

123126
Search for sniffs which have `public` properties which can be changed from within a ruleset.
124127

125128
* If the sniff has workarounds in place to handle non-lowercase string `'true'` or `'false'` values for boolean properties, those workarounds can be removed.
126129
* If the sniff has workarounds in place to handle (any case) string `'null'` values, those workarounds can be removed.
127130
* If the sniff explicitly expects only string values for array elements, the sniff may need to be updated.
131+
Also take note of the fact that array elements can now no longer contain an empty string value as that value will be cast to `null`, same as empty string values for non-array properties.
128132
* If the sniff has workarounds in place to handle the type casting of `true`, `false` and/or `null` for array elements, those workarounds can be removed.
129133

130134
<p align="right"><a href="#table-of-contents">back to top</a></p>

0 commit comments

Comments
 (0)