Closed
Description
Snippet 1:
<?php
$unused_variable = 'foo';
With the default configuration (phpcs --standard=VariableAnalysis -s phpcs-test.php
), this is detected as "Unused variable $unused_variable (VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable)". ✅
Snippet 2:
<?php
$unused_variable = 'foo';
?>
The addition of the ?>
stops the violation from being reported, even though the variable is still unused. ❌
Tested in VA 2.11.0.