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

Bug #19413 php_cs thinks I haven't used a parameter when I have
Submitted: 2012-05-10 02:53 UTC
From: petdance Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.3)
PHP Version: 5.3.6 OS: CentOS 5 Linux
Roadmaps: (Not assigned)    
Subscription  


 [2012-05-10 02:53 UTC] petdance (Andy Lester)
Description: ------------ I ran php_cs on a source file that had a function in it with an argument. php_cs incorrectly said that the function never used the argument but it did. I was able to reduce the problem down to a single sample file, in the "Test script" section. The spacing is important, as noted in the source There may be other ways to get this to fail, but this one is the smallest I was able to come up with and make it repeatable.lk Test script: --------------- <?php function foo( $parameter ) { $wango = <<<HERE 1 Must be a HEREdoc of at least one line HERE; $x = $parameter; // This line must be immediately after the HERE; with no intervening blank lines. $tango = <<<HERE 1 Must be a HEREdoc 2 3 4 5 6 7 8 9 at least 9 lines long HERE; } Actual result: -------------- FILE: /home/alester/scraps/sniffbugs.php -------------------------------------------------------------------------------- FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 2 | WARNING | The method parameter $parameter is never used --------------------------------------------------------------------------------

Comments

 [2012-05-10 10:57 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
Fixed in git repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/7f703b27a70d041cb6cb86b49 d8e03c4a11b25fa
 [2012-05-11 10:41 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed