Skip to content

Commit 3f1fd98

Browse files
committed
Update StaticCallHandler.php
1 parent 606309c commit 3f1fd98

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/Analyser/ExprHandler/StaticCallHandler.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -269,33 +269,30 @@ public function processExpr(NodeScopeResolver $nodeScopeResolver, Stmt $stmt, Ex
269269
);
270270
}
271271

272-
private function getStaticMethodThrowPoint(MethodReflection $methodReflection, ParametersAcceptor $parametersAcceptor, StaticCall $methodCall, MutatingScope $scope): ?InternalThrowPoint
272+
private function getStaticMethodThrowPoint(MethodReflection $methodReflection, ParametersAcceptor $parametersAcceptor, StaticCall $normalizedMethodCall, MutatingScope $scope): ?InternalThrowPoint
273273
{
274-
$normalizedMethodCall = ArgumentsNormalizer::reorderStaticCallArguments($parametersAcceptor, $methodCall);
275-
if ($normalizedMethodCall !== null) {
276-
foreach ($this->dynamicThrowTypeExtensionProvider->getDynamicStaticMethodThrowTypeExtensions() as $extension) {
277-
if (!$extension->isStaticMethodSupported($methodReflection)) {
278-
continue;
279-
}
280-
281-
$throwType = $extension->getThrowTypeFromStaticMethodCall($methodReflection, $normalizedMethodCall, $scope);
282-
if ($throwType === null) {
283-
return null;
284-
}
274+
foreach ($this->dynamicThrowTypeExtensionProvider->getDynamicStaticMethodThrowTypeExtensions() as $extension) {
275+
if (!$extension->isStaticMethodSupported($methodReflection)) {
276+
continue;
277+
}
285278

286-
return InternalThrowPoint::createExplicit($scope, $throwType, $methodCall, false);
279+
$throwType = $extension->getThrowTypeFromStaticMethodCall($methodReflection, $normalizedMethodCall, $scope);
280+
if ($throwType === null) {
281+
return null;
287282
}
283+
284+
return InternalThrowPoint::createExplicit($scope, $throwType, $normalizedMethodCall, false);
288285
}
289286

290287
if ($methodReflection->getThrowType() !== null) {
291288
$throwType = $methodReflection->getThrowType();
292289
if (!$throwType->isVoid()->yes()) {
293-
return InternalThrowPoint::createExplicit($scope, $throwType, $methodCall, true);
290+
return InternalThrowPoint::createExplicit($scope, $throwType, $normalizedMethodCall, true);
294291
}
295292
} elseif ($this->implicitThrows) {
296-
$methodReturnedType = $scope->getType($methodCall);
293+
$methodReturnedType = $scope->getType($normalizedMethodCall);
297294
if (!(new ObjectType(Throwable::class))->isSuperTypeOf($methodReturnedType)->yes()) {
298-
return InternalThrowPoint::createImplicit($scope, $methodCall);
295+
return InternalThrowPoint::createImplicit($scope, $normalizedMethodCall);
299296
}
300297
}
301298

0 commit comments

Comments
 (0)