Skip to content

Commit c4ba7f9

Browse files
committed
Always use getKeepVoidType
1 parent 604e277 commit c4ba7f9

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ parameters:
5050
message: "#but it's missing from the PHPDoc @throws tag\\.$#" # allow uncatched exceptions in tests
5151
path: tests/*
5252

53-
-
54-
message: '#^Call to function method_exists\(\) with PHPStan\\Analyser\\Scope and ''getKeepVoidType'' will always evaluate to true\.$#'
55-
path: src/Rule/ForbidUnusedMatchResultRule.php
56-
reportUnmatched: false # fails only for PHPStan > 1.10.49
57-
5853
# ignore BC promises
5954
- identifier: phpstanApi.class
6055
- identifier: phpstanApi.method

src/Rule/ForbidUnusedMatchResultRule.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
use PHPStan\Rules\Rule;
1111
use PHPStan\Rules\RuleErrorBuilder;
1212
use PHPStan\Type\NeverType;
13-
use PHPStan\Type\Type;
1413
use PHPStan\Type\TypeCombinator;
1514
use PHPStan\Type\VerbosityLevel;
1615
use ShipMonk\PHPStan\Visitor\UnusedMatchVisitor;
17-
use function method_exists;
1816

1917
/**
2018
* @implements Rule<Match_>
@@ -36,10 +34,7 @@ public function processNode(Node $node, Scope $scope): array
3634
$returnedTypes = [];
3735

3836
foreach ($node->arms as $arm) {
39-
/** @var Type $armType */
40-
$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
41-
? $scope->getKeepVoidType($arm->body)
42-
: $scope->getType($arm->body);
37+
$armType = $scope->getKeepVoidType($arm->body);
4338

4439
if (!$armType->isVoid()->yes() && !$armType instanceof NeverType && !$arm->body instanceof Assign) {
4540
$returnedTypes[] = $armType;

0 commit comments

Comments
 (0)