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

Bug #19908 PEAR MultiLineCondition Does Not Apply elseif
Submitted: 2013-04-23 04:17 UTC
From: nolkel Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.0RC2)
PHP Version: 5.3.5 OS: Windows 7
Roadmaps: (Not assigned)    

 [2013-04-23 04:17 UTC] nolkel (Nolan Kelly)
Description: ------------ The PEAR standard includes some rules to validate the formatting of multiline condition statements. They appear to only be triggered when the control statement is "if" or "else if". When the control statement is "elseif", the rules are not triggered. In the example test script, line 4 should trigger "StartWithBoolean" because the or operator is on line 3. If I change the keyword to "else if", the error will be triggered. Both of these rules exhibit this behavior: PEAR.ControlStructures.MultiLineCondition.StartWithBoolean PEAR.ControlStructures.MultiLineCondition.CloseBracketNewLi ne Test script: --------------- if ($a == $b) { $a = $d; } elseif (($a != $b) || ($b != $c) ) { $a = $c; } else { $a = $b; } Expected result: ---------------- 4 ERROR Each line in a multi-line IF statement must begin with a boolean operator | | (PEAR.ControlStructures.MultiLineCondition.StartWithBoolean) Actual result: -------------- No ERROR is detected, and no output is generated.


 [2013-04-23 06:39 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to github repo: 55b27330928b2d