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

Bug #20247 The "Squiz.WhiteSpace.ControlStructureSpacing" sniff and "do-while"
Submitted: 2014-04-20 03: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)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 11 + 48 = ?

 
 [2014-04-20 03:00 UTC] aik099 (Alexander Obuhovich)
Description: ------------ The spacing around condition in the "do-while" loop aren't checked because of https://github.com/squizlabs/PHP_CodeSniffer/blob/1.5.2/CodeSn iffer/Standards/Squiz/Sniffs/WhiteSpace/ControlStructureSpacing Sniff.php#L78-L80 IF statement. I recommend moving mentioned IF before https://github.com/squizlabs/PHP_CodeSniffer/blob/1.5.2/CodeSn 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 }

Comments

 [2014-04-29 11:03 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to Github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/62fd10576995552714b1510ba5 d40ef19cf11d20 Thanks for providing the changes.