Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
use ReflectionProvider in ParentClassMethodNodeResolver (#4166)
Browse files Browse the repository at this point in the history
* use ReflectionProvider in ParentClassMethodNodeResolver

* Update ParentClassMethodNodeResolver.php

* Update ParentClassMethodNodeResolver.php

* Update ParentClassMethodNodeResolver.php
  • Loading branch information
staabm authored Jun 11, 2022
1 parent b107450 commit 915ca55
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/phpstan-rules/src/ParentClassMethodNodeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use ReflectionMethod;
use PHPStan\Reflection\ReflectionProvider;
use Symplify\Astral\Reflection\ReflectionParser;

final class ParentClassMethodNodeResolver
{
public function __construct(
private ReflectionParser $reflectionParser
private ReflectionParser $reflectionParser,
private ReflectionProvider $reflectionProvider
) {
}

Expand All @@ -26,7 +27,8 @@ public function resolveParentClassMethod(Scope $scope, string $methodName): ?Cla
continue;
}

$parentMethodReflection = new ReflectionMethod($parentClassReflection->getName(), $methodName);
$classReflection = $this->reflectionProvider->getClass($parentClassReflection->getName());
$parentMethodReflection = $classReflection->getMethod($methodName, $scope);
return $this->reflectionParser->parseMethodReflection($parentMethodReflection);
}

Expand Down

0 comments on commit 915ca55

Please sign in to comment.