Skip to content

Commit 0f05c71

Browse files
committed
Fix
1 parent c561fe0 commit 0f05c71

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
use PhpParser\Node;
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Node\InClassMethodNode;
8-
use PHPStan\Reflection\MethodReflection;
98
use PHPStan\Reflection\ParametersAcceptorSelector;
109
use PHPStan\Rules\Rule;
11-
use PHPStan\ShouldNotHappenException;
1210
use function sprintf;
1311

1412
/**
@@ -36,11 +34,7 @@ public function processNode(Node $node, Scope $scope): array
3634
return [];
3735
}
3836

39-
/** @var MethodReflection $method */
40-
$method = $scope->getFunction();
41-
if (!$method instanceof MethodReflection) {
42-
throw new ShouldNotHappenException();
43-
}
37+
$method = $node->getMethodReflection();
4438
$methodSignature = ParametersAcceptorSelector::selectSingle($method->getVariants());
4539

4640
$errors = [];

0 commit comments

Comments
 (0)