Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.6.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)    
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 : 21 - 3 = ?

 [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 --------------------------------------------------------------------------------


 [2012-05-11 10:11 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
Fixed in git repo: 85e23eaaf84297
 [2012-05-11 10:40 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed