Skip to content

Commit 6de7c0f

Browse files
committed
Fix deprecation of ParametersAcceptorSelector::selectSingle()
1 parent 534ee63 commit 6de7c0f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Rules/Functions/FactoriesFunctionArgumentTypeRule.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ public function processNode(Node $node, Scope $scope): array
9090

9191
$returnType = $this->factoriesReturnTypeHelper->check($nameType, $function);
9292

93-
$firstParameter = ParametersAcceptorSelector::selectSingle(
93+
$firstParameter = ParametersAcceptorSelector::selectFromArgs(
94+
$scope,
95+
$node->getArgs(),
9496
$this->reflectionProvider->getFunction($nameNode, $scope)->getVariants()
9597
)->getParameters()[0];
9698

src/Type/ServicesReturnTypeHelper.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Config\Services as AppServices;
1919
use PHPStan\Analyser\Scope;
2020
use PHPStan\Reflection\ClassReflection;
21+
use PHPStan\Reflection\ParametersAcceptor;
2122
use PHPStan\Reflection\ParametersAcceptorSelector;
2223
use PHPStan\Reflection\ReflectionProvider;
2324
use PHPStan\ShouldNotHappenException;
@@ -102,7 +103,11 @@ public function check(Type $type, Scope $scope): Type
102103
return new NullType();
103104
}
104105

105-
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
106+
return ParametersAcceptorSelector::selectFromArgs(
107+
$scope,
108+
[],
109+
$methodReflection->getVariants()
110+
)->getReturnType();
106111
}
107112

108113
return new NullType();

0 commit comments

Comments
 (0)