Skip to content

Commit 6d02b96

Browse files
committed
use directly type combinator
1 parent 7544b31 commit 6d02b96

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
use PHPStan\Type\StaticType;
1919
use PHPStan\Type\ThisType;
2020
use PHPStan\Type\Type;
21+
use PHPStan\Type\TypeCombinator;
2122
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
2223
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
2324
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
2425
use Rector\DeadCode\PhpDoc\TagRemover\ReturnTagRemover;
2526
use Rector\NodeTypeResolver\Node\AttributeKey;
2627
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
27-
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer;
2828
use Rector\Rector\AbstractRector;
2929
use Rector\Reflection\ReflectionResolver;
3030
use Rector\StaticTypeMapper\StaticTypeMapper;
@@ -45,7 +45,6 @@ public function __construct(
4545
private readonly ReturnTagRemover $returnTagRemover,
4646
private readonly ReflectionResolver $reflectionResolver,
4747
private readonly PrivatesAccessor $privatesAccessor,
48-
private readonly UnionTypeAnalyzer $unionTypeAnalyzer,
4948
private readonly DocBlockUpdater $docBlockUpdater,
5049
private readonly PhpDocInfoFactory $phpDocInfoFactory,
5150
private readonly StaticTypeMapper $staticTypeMapper,
@@ -258,7 +257,7 @@ private function isNullable(Type $parentReturnType, Type $returnType): bool
258257
return false;
259258
}
260259

261-
if (! $this->unionTypeAnalyzer->isNullable($parentReturnType)) {
260+
if (! TypeCombinator::containsNull($parentReturnType)) {
262261
return false;
263262
}
264263

0 commit comments

Comments
 (0)