Commit 8e63627
committed
Functions/DynamicCalls: bug fix - don't blindly use the next text string
A variable value may be build up of multiple tokens.
As it was, the sniff would look for the first text string token after the equal sign within the variable assignment statement, but this disregards that:
1. The text string token found may not be the only token in the statement.
2. A statement can end on a PHP close tag (possibly a bug in PHPCS itself, but that's another matter), which would lead the sniff to look at the next statement for text strings.
Fixed now.
Includes unit tests, the first four of which resulted in false positives previously.1 parent df8c596 commit 8e63627
File tree
2 files changed
+40
-13
lines changed- WordPressVIPMinimum
- Sniffs/Functions
- Tests/Functions
2 files changed
+40
-13
lines changedLines changed: 23 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
125 | 132 | | |
126 | | - | |
| 133 | + | |
| 134 | + | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
131 | | - | |
132 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
133 | 143 | | |
134 | | - | |
| 144 | + | |
135 | 145 | | |
136 | 146 | | |
137 | 147 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments