Commit 3f9b441
committed
Generic/InlineControlStructure: removed another unnecessary code block
The original version of this part of the code that is now being removed
was added in the early days by the commit that enabled this sniff to fix
errors:
squizlabs/PHP_CodeSniffer@a54c619#diff-4b3945c2100b0a92a56509de1b797bf58ad804cf36233c95c492479b665655dcR148-R154
The only two tests that were added with the commit mentioned above
that trigger the removed condition are tests using `while` loops
without body:
squizlabs/PHP_CodeSniffer@a54c619#diff-116c49a7b0b31f724fc25409e31ba119d7f023146818bcb63edbe8f4071422e2R42-R43
Control structures without a body are the only cases where `$next`
would be equal to `$end`. Thus, these are the only cases where the
removed condition would be executed. But two previous commits, changed
the sniff to bail early and not get to the fixer part when handling
control structures without a body. 13c803b changed the sniff to ignore
while/for without a body and updated the existing tests
(squizlabs/PHP_CodeSniffer@13c803b#diff-2f069f3fe33bacdfc80485b97303aec66c98c451d07e6d86e41982b81ab1a294L49-R50).
2e875e7 expanded the same approach for do while/else/elseif/if/foreach
control structures.
After the removal of the `$next !== $end`, the `$next` variable became
used allowing to further simplify the code by removing the place where
it was being defined.
Note for reviewers: this commit is easier to evaluate when ignoring
whitespaces.1 parent eb081e0 commit 3f9b441
File tree
1 file changed
+48
-81
lines changed- src/Standards/Generic/Sniffs/ControlStructures
1 file changed
+48
-81
lines changedLines changed: 48 additions & 81 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | 264 | | |
298 | | - | |
299 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
300 | 270 | | |
301 | | - | |
| 271 | + | |
302 | 272 | | |
303 | 273 | | |
304 | 274 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
309 | 278 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
318 | 284 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
326 | 291 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
331 | 298 | | |
332 | | - | |
333 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
334 | 305 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
343 | 310 | | |
| 311 | + | |
344 | 312 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
351 | 319 | | |
352 | 320 | | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
359 | 324 | | |
| 325 | + | |
| 326 | + | |
360 | 327 | | |
361 | 328 | | |
362 | 329 | | |
| |||
0 commit comments