Commit b0c442a
committed
Squiz/IncrementDecrementUsage: bug fix - comments between variable and equal sign
As this is a sniff looking for certain functional code patterns, the sniff should disregard whitespace and comments when looking for the relevant tokens to determine whether the code under scan contains the code pattern the sniff is looking for.
The sniff, however, does not do this correctly (in multiple places).
This commit fixes another one of these issues.
In this case, if there was a comment between the `$var` and the subsequent equal sign, the sniff would incorrectly disregard the assignment as one which should be examined.
Fixed now.
Includes tests.1 parent c29805d commit b0c442a
File tree
3 files changed
+8
-1
lines changed- src/Standards/Squiz
- Sniffs/Operators
- Tests/Operators
3 files changed
+8
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
0 commit comments