Skip to content

Commit 8a2611f

Browse files
authored
[TypedCollections] Use directly param->type->type assign on RemoveNullFromNullableCollectionTypeRector (#397)
* [TypedCollections] Use directly param->type->type assign on RemoveNullFromNullableCollectionTypeRector * [TypedCollections] Use directly param->type->type assign on RemoveNullFromNullableCollectionTypeRector
1 parent 3c8fa9b commit 8a2611f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

rules-tests/TypedCollections/Rector/ClassMethod/RemoveNullFromNullableCollectionTypeRector/Fixture/some_param_nullable.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class SomeParamNullable
2626
{
2727
private $collection;
2828

29-
public function setItems(\Doctrine\Common\Collections\Collection $collection): void
29+
public function setItems(Collection $collection): void
3030
{
3131
$this->collection = $collection;
3232
}

rules/TypedCollections/Rector/ClassMethod/RemoveNullFromNullableCollectionTypeRector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Rector\Doctrine\TypedCollections\Rector\ClassMethod;
66

77
use PhpParser\Node;
8-
use PhpParser\Node\Name\FullyQualified;
98
use PhpParser\Node\NullableType;
109
use PhpParser\Node\Stmt\ClassMethod;
1110
use Rector\Doctrine\Enum\DoctrineClass;
@@ -79,7 +78,7 @@ public function refactor(Node $node): ClassMethod|null
7978
continue;
8079
}
8180

82-
$param->type = new FullyQualified(DoctrineClass::COLLECTION);
81+
$param->type = $realType;
8382
$hasChanged = true;
8483
}
8584

0 commit comments

Comments
 (0)