Set DateTime to DateTimeInterface for DateTime property with DateTimeInterface docblock
final class SomeClass
{
- /**
- * @var DateTimeInterface
- */
- private DateTime $dateTime;
+ private DateTimeInterface $dateTime;
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\Class_\MergeDateTimePropertyTypeDeclarationRector;
return RectorConfig::configure()
->withRules([
MergeDateTimePropertyTypeDeclarationRector::class,
]);