Skip to content

Commit

Permalink
Improved compatibility with PHPStan 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 23, 2021
1 parent a9b2cb1 commit b49efed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Rules/Cast/UselessCastRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
use PHPStan\Type\ErrorType;
use PHPStan\Type\GeneralizePrecision;
use PHPStan\Type\TypeUtils;
use PHPStan\Type\VerbosityLevel;

Expand Down Expand Up @@ -38,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
if ($castType instanceof ErrorType) {
return [];
}
$castType = TypeUtils::generalizeType($castType);
$castType = TypeUtils::generalizeType($castType, GeneralizePrecision::lessSpecific());

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

0 comments on commit b49efed

Please sign in to comment.