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

Bug #20373 Inline comment sniff tab handling way
Submitted: 2014-08-22 23:44 UTC
From: aik099 Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.4)
PHP Version: 5.4.20 OS: Linux
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 : 29 - 28 = ?

 [2014-08-22 23:44 UTC] aik099 (Alexander Obuhovich)
Description: ------------ Consider following code: (image given so you can see where there are tabs and where spaces): ----- class SomeClass { function someMethod() { // This is comment indented with spaces. $a = 5; // This is comment indented with tabs. $a = 5; } } ----- When determening how much spaces there are between // and actual text in Sniffer/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff. php#L166 code only spaces are considered. This way for code above I'm getting error message like this: No space before comment text; expected "// This is comment indented with tabs." but found "// This is In fact there are 2 tabs which is equivalent of 8 spaces. I recommend checking also for \t when counting spaces.


 [2014-08-22 23:52 UTC] aik099 (Alexander Obuhovich)
With spaces used as indentation ltrim doesn't change the output, but with tabs it's different.
 [2014-08-26 07:18 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to Github repo: 8b21839e9cbe75f Now throws a very specific error if tabs are used to indent the comment.