From 0f05c71ae0200620b68b00c32d5f6f530650a74b Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 9 Jan 2023 14:35:15 +0100 Subject: [PATCH] Fix --- .../TypeHintDeprecatedInClassMethodSignatureRule.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php b/src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php index 089f1c2..f116572 100644 --- a/src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php +++ b/src/Rules/Deprecations/TypeHintDeprecatedInClassMethodSignatureRule.php @@ -5,10 +5,8 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; use PHPStan\Node\InClassMethodNode; -use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Rules\Rule; -use PHPStan\ShouldNotHappenException; use function sprintf; /** @@ -36,11 +34,7 @@ public function processNode(Node $node, Scope $scope): array return []; } - /** @var MethodReflection $method */ - $method = $scope->getFunction(); - if (!$method instanceof MethodReflection) { - throw new ShouldNotHappenException(); - } + $method = $node->getMethodReflection(); $methodSignature = ParametersAcceptorSelector::selectSingle($method->getVariants()); $errors = [];