Skip to content

Commit 9f4d18d

Browse files
committed
Update NodeScopeResolver.php
1 parent 7f4485f commit 9f4d18d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,6 +3299,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
32993299
$classType = null;
33003300
$methodReflection = null;
33013301
$methodName = null;
3302+
$dynamicCall = false;
33023303
if ($expr->name instanceof Expr) {
33033304
$result = $this->processExprNode($stmt, $expr->name, $scope, $storage, $nodeCallback, $context->enterDeep());
33043305
$hasYield = $hasYield || $result->hasYield();
@@ -3311,6 +3312,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
33113312
} elseif ($expr->class instanceof Expr) {
33123313
$classType = TypeCombinator::removeNull($scope->getType($expr->class))->getObjectTypeOrClassStringObjectType();
33133314
$methodName = $expr->name->name;
3315+
$dynamicCall = true;
33143316
}
33153317

33163318
if ($classType !== null && $methodName !== null) {
@@ -3323,9 +3325,11 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
33233325
$methodReflection->getNamedArgumentsVariants(),
33243326
);
33253327

3326-
$methodThrowPoint = $this->getStaticMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
3327-
if ($methodThrowPoint !== null) {
3328-
$throwPoints[] = $methodThrowPoint;
3328+
if (!$dynamicCall) {
3329+
$methodThrowPoint = $this->getStaticMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
3330+
if ($methodThrowPoint !== null) {
3331+
$throwPoints[] = $methodThrowPoint;
3332+
}
33293333
}
33303334

33313335
$declaringClass = $methodReflection->getDeclaringClass();

0 commit comments

Comments
 (0)