Skip to content
Permalink
Browse files

Fix #2062 - treat function inside variable method call name as used

  • Loading branch information...
muglug committed Aug 26, 2019
1 parent aec64c1 commit f4f4a32f082d439c7f8c76bb4f04e3794987498d
@@ -74,9 +74,14 @@ public static function analyze(
}
if (!$stmt->name instanceof PhpParser\Node\Identifier) {
$was_inside_call = $context->inside_call;
$context->inside_call = true;
if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->name, $context) === false) {
return false;
}
if (!$was_inside_call) {
$context->inside_call = false;
}
}
if ($stmt->var instanceof PhpParser\Node\Expr\Variable) {
@@ -537,6 +537,21 @@ function foo(string $s, object $o) : void {
$o->foo("COUNT{$s}");
}'
],
'usedFunctioninMethodCallName' => [
'<?php
class Foo {
/**
* @psalm-suppress MixedArgument
*/
public function bar(): void {
/** @var mixed $action */
$action = "";
$this->{"execute" . ucfirst($action)}($request);
}
}
(new Foo)->bar();'
],
];
}

0 comments on commit f4f4a32

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