Make maker bundle generate DateTime property accept DateTimeInterface too
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
*/
class User
{
/**
- * @var DateTime|null
+ * @var DateTimeInterface|null
*/
private $bornAt;
public function setBornAt(DateTimeInterface $bornAt)
{
$this->bornAt = $bornAt;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Doctrine\CodeQuality\Rector\Property\MakeEntityDateTimePropertyDateTimeInterfaceRector;
return RectorConfig::configure()
->withRules([
MakeEntityDateTimePropertyDateTimeInterfaceRector::class,
]);