Commit b3cf51a
committed
PHP 8.3 | Generic/ScopeIndent: bug fix - missing defensive coding
As of PHP 8.3, PHP will throw a `Warning: Decrement on type bool has no effect, this will change in the next major version of PHP` notice.
A test run with PHP 8.3 showed this deprecation notice being thrown in the `Generic.WhiteSpace.ScopeIndent` sniff.
Investigation of the notice showed that this was actually a bug due to too little defensive coding.
The sniff tries to skip over multi-line/multi-token text strings, but the `findNext()` will return `false` for a single-line/single-token text string, which would lead to `$i` being reset to `0`.
This commit fixes this by only changing `$i` when the return from the call to `findNext()` is not `false`.
Ref: https://wiki.php.net/rfc/saner-inc-dec-operators1 parent 7823310 commit b3cf51a
1 file changed
+5
-2
lines changedLines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
971 | | - | |
972 | | - | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
973 | 976 | | |
974 | 977 | | |
975 | 978 | | |
| |||
0 commit comments