|
2 | 2 |
|
3 | 3 | namespace PHPStan\Type; |
4 | 4 |
|
| 5 | +use PHPStan\Internal\CombinationsHelper; |
5 | 6 | use PHPStan\Php\PhpVersion; |
6 | 7 | use PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode; |
7 | 8 | use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode; |
|
16 | 17 | use PHPStan\Reflection\MissingConstantFromReflectionException; |
17 | 18 | use PHPStan\Reflection\MissingMethodFromReflectionException; |
18 | 19 | use PHPStan\Reflection\MissingPropertyFromReflectionException; |
| 20 | +use PHPStan\Reflection\ParametersAcceptorSelector; |
19 | 21 | use PHPStan\Reflection\Type\IntersectionTypeUnresolvedMethodPrototypeReflection; |
20 | 22 | use PHPStan\Reflection\Type\IntersectionTypeUnresolvedPropertyPrototypeReflection; |
21 | 23 | use PHPStan\Reflection\Type\UnresolvedMethodPrototypeReflection; |
@@ -1141,14 +1143,20 @@ public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope) |
1141 | 1143 | } |
1142 | 1144 |
|
1143 | 1145 | if (count($yesAcceptors) > 0) { |
1144 | | - return array_merge(...$yesAcceptors); |
| 1146 | + $acceptors = $yesAcceptors; |
| 1147 | + } elseif(count($maybeAcceptors) > 0) { |
| 1148 | + $acceptors = $maybeAcceptors; |
| 1149 | + } else { |
| 1150 | + throw new ShouldNotHappenException(); |
1145 | 1151 | } |
1146 | 1152 |
|
1147 | | - if (count($maybeAcceptors) > 0) { |
1148 | | - return array_merge(...$maybeAcceptors); |
| 1153 | + $result = []; |
| 1154 | + $combinations = CombinationsHelper::combinations($acceptors); |
| 1155 | + foreach ($combinations as $combination) { |
| 1156 | + $result[] = ParametersAcceptorSelector::combineAcceptors($combination); |
1149 | 1157 | } |
1150 | 1158 |
|
1151 | | - throw new ShouldNotHappenException(); |
| 1159 | + return $result; |
1152 | 1160 | } |
1153 | 1161 |
|
1154 | 1162 | public function isCloneable(): TrinaryLogic |
|
0 commit comments