Commit afc03c6
committed
Generic/LowerCaseType: bug fix in intersection type ignore code
PR squizlabs/PHP_CodeSniffer 3581 introduced support for PHP 8.1 intersection types.
_Note: the sniff, or PHPCS itself for that matter, currently does not (yet) support PHP 8.2 DNF types. Once support for DNF types has been added, this sniff will need a further update/fix.
For now, for the purpose of this sniff, intersection types should be skipped as they cannot contain the simple types for which the case is being checked by this sniff.
However, the check for whether a type is an intersection type or not was wrong.
The `'*type_token'` key for each of these checks contains the stack pointer to the _first_ token in the type declaration, so the comparison with `T_TYPE_INTERSECTION` will always yield `false`.
This did not lead to false positives due to how the type is handled after that, but is still a bug which should be fixed.1 parent 2fbf9e3 commit afc03c6
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
0 commit comments