Skip to content

Commit

Permalink
[TypeDeclaration] Fix missing change type to DateTimeInterface on Mer…
Browse files Browse the repository at this point in the history
…geDateTimePropertyTypeDeclarationRector (#5329)
  • Loading branch information
samsonasik committed Dec 5, 2023
1 parent b1a50d4 commit d22741e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -18,7 +18,7 @@ namespace Rector\Tests\TypeDeclaration\Rector\Class_\MergeDateTimePropertyTypeDe

final class SomeClass
{
private \DateTime $dateTime;
private \DateTimeInterface $dateTime;
}

?>
Expand Up @@ -95,6 +95,8 @@ public function refactor(Node $node): ?Node
if ($varType instanceof FullyQualifiedObjectType && $varType->getClassName() === 'DateTimeInterface') {
$phpDocInfo->removeByType(VarTagValueNode::class);
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);

$property->type = new FullyQualified('DateTimeInterface');
$hasChanged = true;
}
}
Expand Down

0 comments on commit d22741e

Please sign in to comment.