Commit 5529947
committed
Squiz/OperatorBracket: stability tweak
The `$allowed` tokens array is joined after declaration with the `Tokens::$operators` array. This is only reliable if the keys in both arrays are unique (or intended to be overwritten).
However, with the `$allowed` array being numerically indexed and PHP native tokens also being integers, this was not the case and could lead to one of the tokens in the original array (unintentionally) being disregarded/overwritten by one of the tokens in the `Tokens::$operators` array.
Fixed now, by making setting the tokens constants both as the key as well as the value, making the entries in the array suitable for an array join operation.1 parent e8b10e0 commit 5529947
File tree
1 file changed
+21
-21
lines changed- src/Standards/Squiz/Sniffs/Formatting
1 file changed
+21
-21
lines changedLines changed: 21 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
0 commit comments