Skip to content

Commit b49efed

Browse files
committed
Improved compatibility with PHPStan 1.0
1 parent a9b2cb1 commit b49efed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Rules/Cast/UselessCastRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use PHPStan\Rules\RuleError;
99
use PHPStan\Rules\RuleErrorBuilder;
1010
use PHPStan\Type\ErrorType;
11+
use PHPStan\Type\GeneralizePrecision;
1112
use PHPStan\Type\TypeUtils;
1213
use PHPStan\Type\VerbosityLevel;
1314

@@ -38,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
3839
if ($castType instanceof ErrorType) {
3940
return [];
4041
}
41-
$castType = TypeUtils::generalizeType($castType);
42+
$castType = TypeUtils::generalizeType($castType, GeneralizePrecision::lessSpecific());
4243

4344
if ($this->treatPhpDocTypesAsCertain) {
4445
$expressionType = $scope->getType($node->expr);

0 commit comments

Comments
 (0)