diff --git a/src/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRule.php b/src/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRule.php index 193bd37..bfb83a1 100644 --- a/src/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRule.php +++ b/src/Rules/Deprecations/TypeHintDeprecatedInClosureSignatureRule.php @@ -5,7 +5,6 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; use PHPStan\Node\InClosureNode; -use PHPStan\Reflection\ParametersAcceptor; use PHPStan\Rules\Rule; use PHPStan\ShouldNotHappenException; use function sprintf; @@ -36,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array } $functionSignature = $scope->getAnonymousFunctionReflection(); - if (!$functionSignature instanceof ParametersAcceptor) { + if ($functionSignature === null) { throw new ShouldNotHappenException(); } diff --git a/src/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRule.php b/src/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRule.php index 961282b..9c91ec9 100644 --- a/src/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRule.php +++ b/src/Rules/Deprecations/TypeHintDeprecatedInFunctionSignatureRule.php @@ -5,7 +5,6 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; use PHPStan\Node\InFunctionNode; -use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Rules\Rule; use PHPStan\ShouldNotHappenException; @@ -37,7 +36,7 @@ public function processNode(Node $node, Scope $scope): array } $function = $scope->getFunction(); - if (!$function instanceof FunctionReflection) { + if ($function === null) { throw new ShouldNotHappenException(); } $functionSignature = ParametersAcceptorSelector::selectSingle($function->getVariants());