Commit c4f82b2
committed
WIP NamingConventions/PrefixAllGlobals: improve prefix validation
Add a new error when validating prefixes if a prefix is not a string or is an empty string.
This is necessary in preparation for PHPCS 4.0. Starting with this version, array properties can have types other than string, and the sniff needs to be updated to handle non-string prefixes.
Using the same error when the string is empty made sense as before the sniff would generate an error complaining about the length of the prefix.
TODO: the value of the prefix is type casted to a string when displaying the error message. For example, `true` becomes `1`. I need to think if this is a problem or not.
Also, if `true` is passed as the first and only element of an array property there seems to be an error in PHPCS.
Check how PHPCSStandards/PHP_CodeSniffer#1172 and PHPCSStandards/PHP_CodeSniffer#1193 impact this commit.1 parent 883bb4f commit c4f82b2
File tree
1 file changed
+10
-0
lines changed- WordPress/Sniffs/NamingConventions
1 file changed
+10
-0
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1224 | 1224 | | |
1225 | 1225 | | |
1226 | 1226 | | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1227 | 1237 | | |
1228 | 1238 | | |
1229 | 1239 | | |
| |||
0 commit comments