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

Bug #19414 php_cs seems to not track variables correctly in heredocs
Submitted: 2012-05-10 04:10 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 04:10 UTC] petdance (Andy Lester)
Description: ------------ php_cs complains that $parameter is not used, when it clearly is. If you remove the "<?xml...>" line from the heredoc, php_cs no longer warns Test script: --------------- <?php function foo( $parameter ) { return <<<HTML <?xml version="1.0"?> <value>$parameter</value> HTML; } print foo( 'PARAMETER' ); print "\n"; 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-11 10:11 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
Fixed in git repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/d8f22be5a02aff870471b024f6 85e23eaaf84297
 [2012-05-11 10:40 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed