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

Bug #19644 Alternative syntax, e.g. if/endif triggers Inline Control Structure error
Submitted: 2012-10-09 15:48 UTC
From: zygous Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version SVN)
PHP Version: 5.4.4 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 : 3 + 1 = ?

 
 [2012-10-09 15:48 UTC] zygous (Richard Turner)
Description: ------------ I like to use alternative syntax in template files, e.g. if/endif, foreach/endforeach, etc. PHPCS flags-up these usages as examples of inline control structures because it cannot find opening braces. Instead the sniff should check for a colon and corresponding end token and suppress the error message if these are found. Test script: --------------- <?php if (true) { echo 'this is ok'; } if (false) : echo 'this is not ok'; endif;

Comments

 [2012-10-17 04:01 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fixed in github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/c18e898d2ed02c775bbc904e8 cb66c87cd3b203f