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

Bug #20190 Invalid regex in Squiz_Sniffs_WhiteSpace_SuperfluousWhitespaceSniff
Submitted: 2014-01-31 12:03 UTC
From: endeveit Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.1)
PHP Version: Irrelevant OS: Mac OS X
Roadmaps: (Not assigned)    
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:
Solve the problem : 45 - 43 = ?

 [2014-01-31 12:03 UTC] endeveit (Nikita Vershinin)
Description: ------------ There is a regular expression to check lines for whitespaces in Squiz_Sniffs_WhiteSpace_SuperfluousWhitespaceSniff on line 200. With unicode cyrillic characters it doesn't work and should be this: '|^.*\s+$|u'


 [2014-02-03 04:25 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz
Are you able to provide me with some sample code that fails so I can write a unit test for it?
 [2014-02-03 12:09 UTC] endeveit (Nikita Vershinin)
Sure. The test PHP code: <?php function arrayWalkCallback() { // … some business logic // ?????? ?? ????????? ??????? ??? ????? ?????????? ?? ??????? $serviceKeys = ['re', 'hot', 'color', 'up', 'torg', 'wphoto', 'hasphoto', 'auto_re', 'uuid']; // … other business logic } That's how I run PHP_CodeSniffer: $ php vendor/bin/phpcs --standard=PSR2 --encoding=utf-8 test.php FILE: /Users/endeveit/projects/temp/test.php -------------------------------------------------------------------------------- FOUND 1 ERROR(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 6 | ERROR | Whitespace found at end of line --------------------------------------------------------------------------------
 [2014-02-03 12:12 UTC] endeveit (Nikita Vershinin)
Pear has corrupted unicode. Here is the code on GitHub Gist
 [2014-02-05 04:19 UTC] squiz (Greg Sherwood)
-Status: Feedback +Status: Closed
Thanks a lot for providing that code. I had already fixed this in the phpcs-fixer branch while doing automated fixes for end of line whitespace. At the time, I removed the regex all together as rtrim() worked well for this case. So I applied the same fix for master: 3dfc32530cd3c3
 [2014-02-05 08:21 UTC] endeveit (Nikita Vershinin)
Thank you