diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 062cbb6..322b5d8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -50,11 +50,6 @@ parameters: message: "#but it's missing from the PHPDoc @throws tag\\.$#" # allow uncatched exceptions in tests path: tests/* - - - message: '#^Call to function method_exists\(\) with PHPStan\\Analyser\\Scope and ''getKeepVoidType'' will always evaluate to true\.$#' - path: src/Rule/ForbidUnusedMatchResultRule.php - reportUnmatched: false # fails only for PHPStan > 1.10.49 - # ignore BC promises - identifier: phpstanApi.class - identifier: phpstanApi.method diff --git a/src/Rule/ForbidUnusedMatchResultRule.php b/src/Rule/ForbidUnusedMatchResultRule.php index 58c5009..18fa987 100644 --- a/src/Rule/ForbidUnusedMatchResultRule.php +++ b/src/Rule/ForbidUnusedMatchResultRule.php @@ -36,10 +36,7 @@ public function processNode(Node $node, Scope $scope): array $returnedTypes = []; foreach ($node->arms as $arm) { - /** @var Type $armType */ - $armType = method_exists($scope, 'getKeepVoidType') // Needed since https://github.com/phpstan/phpstan/releases/tag/1.10.49, can be dropped once we bump PHPStan version gte that - ? $scope->getKeepVoidType($arm->body) - : $scope->getType($arm->body); + $armType = $scope->getKeepVoidType($arm->body); if (!$armType->isVoid()->yes() && !$armType instanceof NeverType && !$arm->body instanceof Assign) { $returnedTypes[] = $armType;