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

Bug #21050 PEAR MultiLineCondition sniff suppresses errors on last condition line
Submitted: 2016-04-08 08:41 UTC
From: aashaka Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version SVN)
PHP Version: Irrelevant OS: Ubuntu 14.04
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 : 29 - 26 = ?

 
 [2016-04-08 08:41 UTC] aashaka (Aashaka Shah)
Description: ------------ MultiLineConditionSniff at https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PEAR/Sniffs/ControlStructures/MultiLineConditionSniff.php doesn't cover all cases of position of boolean operators. Test script: --------------- http://pastebin.com/P6nfB2UQ Expected result: ---------------- The code given should specifically give a warning at line 7, since operator || is used at the end of line Actual result: -------------- No warning given at line 7

Comments

 [2016-04-13 23:26 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
When you fix "Closing parenthesis of a multi-line IF statement must be on a new line" on Lind 8, you'll get a new error "Each line in a multi-line IF statement must begin with a boolean operator" on Line 8. So the sniff is able to detect it correctly, and using PHPCBF fixes it correctly as well, but I'll look into if both errors can be reported at the same time.
 [2016-06-27 05:09 UTC] squiz (Greg Sherwood)
-Summary: Mentioned condition is missed in the sniff. +Summary: PEAR MultiLineCondition sniff suppresses errors on last condition line
 [2016-06-27 05:11 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed here: https://github.com/squizlabs/PHP_CodeSniffer/commit/0c4f2c1c5058578967c505deb676157ab268b9 48 Both errors are now reported, even before fixing takes place.