Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.4.0

Bug #20247 The "Squiz.WhiteSpace.ControlStructureSpacing" sniff and "do-while"
Submitted: 2014-04-19 22:00 UTC
From: aik099 Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.2)
PHP Version: 5.4.20 OS: Linux
Roadmaps: (Not assigned)    

 [2014-04-19 22:00 UTC] aik099 (Alexander Obuhovich)
Description: ------------ The spacing around condition in the "do-while" loop aren't checked because of iffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacing Sniff.php#L78-L80 IF statement. I recommend moving mentioned IF before iffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacing Sniff.php#L102 line where it actually makes sense to skip checks if we have no scope. Test script: --------------- do { // some code } while ( $condition ); // don't work while ( $condition ) { // works }


 [2014-04-29 06:03 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to Github repo: d40ef19cf11d20 Thanks for providing the changes.