Skip to content

Commit 79bb916

Browse files
committed
Update NodeScopeResolver.php
1 parent 85ab575 commit 79bb916

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎src/Analyser/NodeScopeResolver.php‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3344,6 +3344,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
33443344
$classType = null;
33453345
$methodReflection = null;
33463346
$methodName = null;
3347+
$dynamicCall = false;
33473348
if ($expr->name instanceof Expr) {
33483349
$result = $this->processExprNode($stmt, $expr->name, $scope, $storage, $nodeCallback, $context->enterDeep());
33493350
$hasYield = $hasYield || $result->hasYield();
@@ -3356,6 +3357,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
33563357
} elseif ($expr->class instanceof Expr) {
33573358
$classType = TypeCombinator::removeNull($scope->getType($expr->class))->getObjectTypeOrClassStringObjectType();
33583359
$methodName = $expr->name->name;
3360+
$dynamicCall = true;
33593361
}
33603362

33613363
if ($classType !== null && $methodName !== null) {
@@ -3368,9 +3370,11 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context, $sto
33683370
$methodReflection->getNamedArgumentsVariants(),
33693371
);
33703372

3371-
$methodThrowPoint = $this->getStaticMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
3372-
if ($methodThrowPoint !== null) {
3373-
$throwPoints[] = $methodThrowPoint;
3373+
if (!$dynamicCall) {
3374+
$methodThrowPoint = $this->getStaticMethodThrowPoint($methodReflection, $parametersAcceptor, $expr, $scope);
3375+
if ($methodThrowPoint !== null) {
3376+
$throwPoints[] = $methodThrowPoint;
3377+
}
33743378
}
33753379

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

0 commit comments

Comments
 (0)