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

Bug #20261 phpcbf has an endless fixing loop
Submitted: 2014-05-01 19:46 UTC
From: phlopsi Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 2.0.0a2)
PHP Version: 5.5.8 OS: Windows 7
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 : 41 + 1 = ?

 
 [2014-05-01 19:46 UTC] phlopsi (Patrick Fischer)
Description: ------------ I ran the following command to beautify/fix AccessControl.php, also found on bitbucket (https://bitbucket.org/Phlopsi/access-control/src/82ab6e0dd76b59dd6eb7bd0c12e48f62dc4e327e/src/org/bitbucket/phlopsi/access_control/AccessControl.php?at=0.1.0): C:\Users\Patrick\git\bitbucket\phlopsi\access-control\src\org\bitbucket\phlopsi\access_control>phpcbf.bat --standard=PSR2 -vvv AccessControl.php > report.txt patch: **** Only garbage was found in the patch input. sadly no fixes were applied and at the bottom of the report.txt i have found this: Reached maximum number of loops with 2 violations left unfixed i've uploaded the report here: https://gist.github.com/phlopsi/b06b0339f748be6fa997#file-report-txt i installed phpcbf through composer (composer global require "squizlabs/php_codesniffer=2.0.0a2")

Comments

 [2014-05-02 05:50 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Thanks for testing the phpcbf script for me. I've fixed this issue, which was caused by the PSR2 sniff incorrectly counting the newline character (/r/n in this case). The fix is here: https://github.com/squizlabs/PHP_CodeSniffer/commit/cb2ce3f4ff4fce3b89e56772246 c1b3b0e9af042 I also noticed that phpcbf wasn't fixing newline chars for you, so I added that in as well. So if you run it on that file now, it will fix all PSR2 errors that it finds.