Skip to content

Commit

Permalink
[PHPStanStaticTypeMapper] Remove Doctrine\Common\Collections\Collecti…
Browse files Browse the repository at this point in the history
…on check on UnionTypeMapper (#5150)
  • Loading branch information
samsonasik committed Oct 10, 2023
1 parent ea3c504 commit fd04aa8
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\PHPStanStaticTypeMapper\DoctrineTypeAnalyzer;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\PHPStanStaticTypeMapper\TypeAnalyzer\UnionTypeAnalyzer;
Expand All @@ -47,7 +46,6 @@ final class UnionTypeMapper implements TypeMapperInterface
private PHPStanStaticTypeMapper $phpStanStaticTypeMapper;

public function __construct(
private readonly DoctrineTypeAnalyzer $doctrineTypeAnalyzer,
private readonly PhpVersionProvider $phpVersionProvider,
private readonly UnionTypeAnalyzer $unionTypeAnalyzer,
private readonly NodeNameResolver $nodeNameResolver,
Expand Down Expand Up @@ -382,14 +380,6 @@ private function resolveAllowedStandaloneTypeInUnionType(

private function resolveCompatibleObjectCandidate(UnionType $unionType): UnionType|TypeWithClassName|null
{
if ($this->doctrineTypeAnalyzer->isDoctrineCollectionWithIterableUnionType($unionType)) {
$objectType = new ObjectType('Doctrine\Common\Collections\Collection');

return $this->unionTypeAnalyzer->isNullable($unionType)
? new UnionType([new NullType(), $objectType])
: $objectType;
}

$typesWithClassNames = $this->unionTypeAnalyzer->matchExclusiveTypesWithClassNames($unionType);
if ($typesWithClassNames === []) {
return null;
Expand Down

0 comments on commit fd04aa8

Please sign in to comment.