Skip to content

Commit d0ed97e

Browse files
committed
fix: make rule phpstan v2 compatible
1 parent 6cec4b6 commit d0ed97e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Rule/InternalMethodCallRule.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
namespace Shopware\PhpStan\Rule;
88

99
use PhpParser\Node;
10-
use PhpParser\Node\Expr\FuncCall;
1110
use PhpParser\Node\Expr\MethodCall;
1211
use PhpParser\Node\Identifier;
1312
use PHPStan\Analyser\Scope;
1413
use PHPStan\Reflection\MissingMethodFromReflectionException;
1514
use PHPStan\Reflection\ReflectionProvider;
1615
use PHPStan\Rules\Rule;
17-
use PHPStan\Type\TypeUtils;
1816
use Shopware\PhpStan\Helper\NamespaceChecker;
1917

2018
/**
@@ -46,11 +44,11 @@ public function processNode(Node $node, Scope $scope): array
4644
$methodName = $node->name->name;
4745
$methodCalledOnType = $scope->getType($node->var);
4846

49-
foreach (TypeUtils::getDirectClassNames($methodCalledOnType) as $class) {
47+
foreach ($methodCalledOnType->getObjectClassNames() as $class) {
5048
$classInfo = $this->reflectionProvider->getClass($class);
5149
try {
5250
$methodDetails = $classInfo->getMethod($methodName, $scope);
53-
} catch (MissingMethodFromReflectionException $e) {
51+
} catch (\PHPStan\Reflection\MissingMethodFromReflectionException $e) {
5452
// Method is not present in class. Nothing to do here for this rule
5553
continue;
5654
}

0 commit comments

Comments
 (0)