Skip to content
Permalink
Browse files

Fix #1996 - detect unused variable in static property name

  • Loading branch information...
muglug committed Aug 9, 2019
1 parent 85c9b6b commit 5254b7501e12030818924fe3c0c86924d9e5cf5a
@@ -992,6 +992,10 @@ public static function analyzeStatic(
$prop_name = $stmt->name;
if (!$prop_name instanceof PhpParser\Node\Identifier) {
if (ExpressionAnalyzer::analyze($statements_analyzer, $prop_name, $context) === false) {
return false;
}
if ($fq_class_name && !$context->ignore_variable_property) {
$codebase->analyzer->addMixedMemberName(
strtolower($fq_class_name) . '::$',
@@ -1020,6 +1020,20 @@ function foo() : void {
A::$method();
}',
],
'usedAsStaticPropertyName' => [
'<?php
class A {
private static bool $something = false;
public function foo() : void {
$var = "something";
if (true) {
static::${$var} = true;
}
}
}'
],
];
}

0 comments on commit 5254b75

Please sign in to comment.
You can’t perform that action at this time.