Bug #19413 [Opn]: php_cs thinks I haven't used a parameter when I have
| From: | gsherwood at squiz dot net | Date: | Thu, 10 May 2012 05:57:37 +0000 |
| Subject: | Bug #19413 [Opn]: php_cs thinks I haven't used a parameter when I have | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8638@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19413&edit=1
ID: 19413
Updated by: gsherwood@squiz.net
Reported By: andy at petdance dot com
Summary: php_cs thinks I haven't used a parameter when I have
Status: Open
Type: Bug
Package: PHP_CodeSniffer
Operating System: CentOS 5 Linux
Package Version: 1.3.3
PHP Version: 5.3.6
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-Assigned To:
+Assigned To: squiz
Fixed in git repo:
https://github.com/squizlabs/PHP_CodeSniffer/commit/7f703b27a70d041cb6cb86b49
d8e03c4a11b25fa
Previous Comments:
------------------------------------------------------------------------
[2012-05-09 22:53:59] petdance
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
--------------------------------------------------------------------------------
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19413&edit=1