X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/ee565ec6dec58e78f964eed1f449fdbd4b003f24..d08d8a1549a2205f39f91fa338ea84fd9bcd2def:/Entity/User.php?ds=inline diff --git a/Entity/User.php b/Entity/User.php index 5220e77..82cbcff 100644 --- a/Entity/User.php +++ b/Entity/User.php @@ -33,12 +33,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface { /** * Create datetime */ - protected \DateTime $created; + protected \DateTimeImmutable $created; /** * Update datetime */ - protected \DateTime $updated; + protected \DateTimeImmutable $updated; /** * Groups collection @@ -58,8 +58,8 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface { */ public function __construct(protected string $mail, protected string $password, protected ?Civility $civility = null, protected ?string $forename = null, protected ?string $surname = null, protected bool $active = false, protected bool $enable = true) { //Set defaults - $this->created = new \DateTime('now'); - $this->updated = new \DateTime('now'); + $this->created = new \DateTimeImmutable('now'); + $this->updated = new \DateTimeImmutable('now'); //Set collections $this->groups = new ArrayCollection(); @@ -212,11 +212,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return User */ - public function setCreated(\DateTime $created): User { + public function setCreated(\DateTimeImmutable $created): User { $this->created = $created; return $this; @@ -225,9 +225,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; }