Skip to content

Commit

Permalink
Use PhpFunctionFromParserNodeReflection as ParametersAcceptor in Depe…
Browse files Browse the repository at this point in the history
…ndencyResolver
  • Loading branch information
ondrejmirtes committed Sep 26, 2024
1 parent e283d3a commit 7e216a2
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Dependency/DependencyResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\ParameterReflectionWithPhpDocs;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\ParametersAcceptorWithPhpDocs;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\ClosureType;
Expand Down Expand Up @@ -70,9 +69,8 @@ public function resolveDependencies(Node $node, Scope $scope): NodeDependencies
}
} elseif ($node instanceof InClassMethodNode) {
$nativeMethod = $node->getMethodReflection();
$parametersAcceptor = ParametersAcceptorSelector::selectSingle($nativeMethod->getVariants());
$this->extractThrowType($nativeMethod->getThrowType(), $dependenciesReflections);
$this->extractFromParametersAcceptor($parametersAcceptor, $dependenciesReflections);
$this->extractFromParametersAcceptor($nativeMethod, $dependenciesReflections);
foreach ($nativeMethod->getAsserts()->getAll() as $assertTag) {
foreach ($assertTag->getType()->getReferencedClasses() as $referencedClass) {
$this->addClassToDependencies($referencedClass, $dependenciesReflections);
Expand Down Expand Up @@ -103,9 +101,8 @@ public function resolveDependencies(Node $node, Scope $scope): NodeDependencies
} elseif ($node instanceof InFunctionNode) {
$functionReflection = $node->getFunctionReflection();
$this->extractThrowType($functionReflection->getThrowType(), $dependenciesReflections);
$parametersAcceptor = ParametersAcceptorSelector::selectSingle($functionReflection->getVariants());

$this->extractFromParametersAcceptor($parametersAcceptor, $dependenciesReflections);
$this->extractFromParametersAcceptor($functionReflection, $dependenciesReflections);
foreach ($functionReflection->getAsserts()->getAll() as $assertTag) {
foreach ($assertTag->getType()->getReferencedClasses() as $referencedClass) {
$this->addClassToDependencies($referencedClass, $dependenciesReflections);
Expand Down

0 comments on commit 7e216a2

Please # to comment.