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

Bug #19616 Nested switches cause false error in PSR2
Submitted: 2012-09-26 14:15 UTC
From: fffjfjj Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.0)
PHP Version: 5.3.15 OS: Mac OS X 10.6.8
Roadmaps: (Not assigned)    
Subscription  


 [2012-09-26 14:15 UTC] fffjfjj (Petit Saltamarti)
Description: ------------ When there are nested switches CodeSniffer detects the following error in PSR2 standard: "There must be a comment when fall-through is intentional in a non-empty case body" But the code has all needed breaks. Test script: --------------- <?php switch (0) { case 0: switch (1) { case 1: echo 'a'; break; } break; } Expected result: ---------------- No error detection when running PHP_CodeSniffer with PSR2 Actual result: -------------- The following false error appears: "There must be a comment when fall-through is intentional in a non-empty case body"

Comments

 [2012-09-27 03:30 UTC] squiz (Greg Sherwood)
-Summary: False error detection in nested switches +Summary: Nested switches cause false error in PSR2 -Assigned To: +Assigned To: squiz
 [2012-09-27 03:32 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed in the github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/1499c3077914e678b30659ea8 c5ddfc69954aceb