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

Bug #21011 Incorrect error message text when newline found after opening brace
Submitted: 2015-12-29 16:06 UTC
From: h3xx Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version SVN)
PHP Version: 5.6.15 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 : 45 - 18 = ?

 
 [2015-12-29 16:06 UTC] h3xx (Dan Church)
Description: ------------ Found a bit of a weird error message in Squiz.WhiteSpace.ControlStructureSpacing that may indicate something fishy is going on. It's telling me "Expected 0 spaces [...]; 0 found." This also affects PSR2.ControlStructures.ControlStructureSpacing which says "Expected 0 spaces after opening bracket; newline found." Steps to reproduce: Run the following on the attached test script. $ phpcs -s --standard=Squiz --sniffs=Squiz.WhiteSpace.ControlStructureSpacing ~/test.php - OR - $ phpcs -s --standard=PSR2 --sniffs=PSR2.ControlStructures.ControlStructureSpacing ~/test.php Test script: --------------- <?php if ( true ) { echo "true is truthy"; } Expected result: ---------------- No output? Actual result: -------------- FILE: /home/dchurch/test.php ------------------------------------------------------------ ---------- FOUND 1 ERROR AFFECTING 1 LINE ------------------------------------------------------------ ---------- 3 | ERROR | [x] Expected 0 spaces after opening bracket; 0 found | | (Squiz.WhiteSpace.ControlStructureSpacing.SpacingAf terOpenBrace) ------------------------------------------------------------ ---------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------ ---------- Time: 21ms; Memory: 2.25Mb

Comments

 [2016-01-11 03:57 UTC] squiz (Greg Sherwood)
-Summary: Odd behavior with newline found after opening brace +Summary: Incorrect errror message text when newline found after opening brace -Assigned To: +Assigned To: squiz
 [2016-01-11 03:58 UTC] squiz (Greg Sherwood)
-Summary: Incorrect errror message text when newline found after opening brace +Summary: Incorrect error message text when newline found after opening brace
 [2016-01-11 04:00 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
The error message was supposed to be "Expected 0 spaces after opening bracket; newline found". This has been fixed here: https://github.com/squizlabs/PHP_CodeSniffer/commit/b024ad84656c37ef5733c6998ebc1e60957b22 77 Thanks for reporting.