From: Raphaƫl Gertz Date: Sat, 5 Dec 2026 03:20:14 +0000 (+0100) Subject: Replace deprecated DateTime by DateTimeImmutable X-Git-Tag: 0.6.1~8 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/44ca28969c807c5e95ac2ae16e1815cd34107564 Replace deprecated DateTime by DateTimeImmutable --- diff --git a/Entity/Application.php b/Entity/Application.php index b2672a1..23f44bf 100644 --- a/Entity/Application.php +++ b/Entity/Application.php @@ -35,17 +35,17 @@ class Application { /** * Cancel datetime */ - private ?\DateTime $canceled = null; + private ?\DateTimeImmutable $canceled = null; /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Session instance @@ -62,8 +62,8 @@ class Application { */ public function __construct() { //Set defaults - $this->created = new \DateTime('now'); - $this->updated = new \DateTime('now'); + $this->created = new \DateTimeImmutable('now'); + $this->updated = new \DateTimeImmutable('now'); } /** @@ -122,11 +122,11 @@ class Application { /** * Set canceled * - * @param \DateTime $canceled + * @param \DateTimeImmutable $canceled * * @return Application */ - public function setCanceled(?\DateTime $canceled): Application { + public function setCanceled(?\DateTimeImmutable $canceled): Application { $this->canceled = $canceled; return $this; @@ -135,20 +135,20 @@ class Application { /** * Get canceled * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCanceled(): ?\DateTime { + public function getCanceled(): ?\DateTimeImmutable { return $this->canceled; } /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Application */ - public function setCreated(\DateTime $created): Application { + public function setCreated(\DateTimeImmutable $created): Application { $this->created = $created; return $this; @@ -157,20 +157,20 @@ class Application { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Application */ - public function setUpdated(\DateTime $updated): Application { + public function setUpdated(\DateTimeImmutable $updated): Application { $this->updated = $updated; return $this; @@ -179,9 +179,9 @@ class Application { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -236,7 +236,7 @@ class Application { //Check that we have an application instance if (($application = $eventArgs->getObject()) instanceof Application) { //Set updated value - $application->setUpdated(new \DateTime('now')); + $application->setUpdated(new \DateTimeImmutable('now')); } } } diff --git a/Entity/Country.php b/Entity/Country.php index 48a3037..b6b4391 100644 --- a/Entity/Country.php +++ b/Entity/Country.php @@ -27,12 +27,12 @@ class Country { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Users collection @@ -48,8 +48,8 @@ class Country { */ public function __construct(private string $code, private string $alpha, private string $title) { //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->users = new ArrayCollection(); @@ -133,11 +133,11 @@ class Country { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Country */ - public function setCreated(\DateTime $created): Country { + public function setCreated(\DateTimeImmutable $created): Country { $this->created = $created; return $this; @@ -146,20 +146,20 @@ class Country { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Country */ - public function setUpdated(\DateTime $updated): Country { + public function setUpdated(\DateTimeImmutable $updated): Country { $this->updated = $updated; return $this; @@ -168,9 +168,9 @@ class Country { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -212,7 +212,7 @@ class Country { //Check that we have an country instance if (($country = $eventArgs->getObject()) instanceof Country) { //Set updated value - $country->setUpdated(new \DateTime('now')); + $country->setUpdated(new \DateTimeImmutable('now')); } } diff --git a/Entity/Dance.php b/Entity/Dance.php index 6ae5f1b..888a568 100644 --- a/Entity/Dance.php +++ b/Entity/Dance.php @@ -27,12 +27,12 @@ class Dance { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Applications collection @@ -52,8 +52,8 @@ class Dance { */ public function __construct(private string $name, private string $type) { //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->applications = new ArrayCollection(); @@ -116,11 +116,11 @@ class Dance { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Dance */ - public function setCreated(\DateTime $created): Dance { + public function setCreated(\DateTimeImmutable $created): Dance { $this->created = $created; return $this; @@ -129,20 +129,20 @@ class Dance { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Dance */ - public function setUpdated(\DateTime $updated): Dance { + public function setUpdated(\DateTimeImmutable $updated): Dance { $this->updated = $updated; return $this; @@ -151,9 +151,9 @@ class Dance { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -240,7 +240,7 @@ class Dance { //Check that we have a dance instance if (($dance = $eventArgs->getObject()) instanceof Dance) { //Set updated value - $dance->setUpdated(new \DateTime('now')); + $dance->setUpdated(new \DateTimeImmutable('now')); } } diff --git a/Entity/GoogleCalendar.php b/Entity/GoogleCalendar.php index f4ef2ce..edf124c 100644 --- a/Entity/GoogleCalendar.php +++ b/Entity/GoogleCalendar.php @@ -25,12 +25,12 @@ class GoogleCalendar { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Constructor @@ -38,12 +38,12 @@ class GoogleCalendar { * @param GoogleToken $googleToken The google token * @param string $mail The google calendar id * @param string $summary The google calendar summary - * @param \DateTime $synchronized The google calendar last synchronization + * @param \DateTimeImmutable $synchronized The google calendar last synchronization */ - public function __construct(private GoogleToken $googleToken, private string $mail, private string $summary, private \DateTime $synchronized = new \DateTime('now')) { + public function __construct(private GoogleToken $googleToken, private string $mail, private string $summary, private \DateTimeImmutable $synchronized = new \DateTime('now')) { //Set defaults - $this->created = new \DateTime('now'); - $this->updated = new \DateTime('now'); + $this->created = new \DateTimeImmutable('now'); + $this->updated = new \DateTimeImmutable('now'); } /** @@ -100,11 +100,11 @@ class GoogleCalendar { /** * Set synchronized * - * @param \DateTime $synchronized + * @param \DateTimeImmutable $synchronized * * @return GoogleCalendar */ - public function setSynchronized(\DateTime $synchronized): GoogleCalendar { + public function setSynchronized(\DateTimeImmutable $synchronized): GoogleCalendar { $this->synchronized = $synchronized; return $this; @@ -113,20 +113,20 @@ class GoogleCalendar { /** * Get synchronized * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getSynchronized(): \DateTime { + public function getSynchronized(): \DateTimeImmutable { return $this->synchronized; } /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return GoogleCalendar */ - public function setCreated(\DateTime $created): GoogleCalendar { + public function setCreated(\DateTimeImmutable $created): GoogleCalendar { $this->created = $created; return $this; @@ -135,20 +135,20 @@ class GoogleCalendar { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return GoogleCalendar */ - public function setUpdated(\DateTime $updated): GoogleCalendar { + public function setUpdated(\DateTimeImmutable $updated): GoogleCalendar { $this->updated = $updated; return $this; @@ -157,9 +157,9 @@ class GoogleCalendar { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -192,7 +192,7 @@ class GoogleCalendar { //Check that we have an snippet instance if (($entity = $eventArgs->getObject()) instanceof GoogleCalendar) { //Set updated value - return $entity->setUpdated(new \DateTime('now')); + return $entity->setUpdated(new \DateTimeImmutable('now')); } } } diff --git a/Entity/GoogleToken.php b/Entity/GoogleToken.php index e44b176..5f29781 100644 --- a/Entity/GoogleToken.php +++ b/Entity/GoogleToken.php @@ -27,12 +27,12 @@ class GoogleToken { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Google calendars collection @@ -45,13 +45,13 @@ class GoogleToken { * @param User $user The user instance * @param string The token user mail * @param string The access token identifier - * @param \DateTime The access token expires + * @param \DateTimeImmutable The access token expires * @param ?string The refresh token identifier */ - public function __construct(private User $user, private string $mail, private string $access, private \DateTime $expired, private ?string $refresh = null) { + public function __construct(private User $user, private string $mail, private string $access, private \DateTimeImmutable $expired, private ?string $refresh = null) { //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->googleCalendars = new ArrayCollection(); @@ -134,11 +134,11 @@ class GoogleToken { /** * Set expired * - * @param \DateTime $expired + * @param \DateTimeImmutable $expired * * @return GoogleToken */ - public function setExpired(\DateTime $expired): GoogleToken { + public function setExpired(\DateTimeImmutable $expired): GoogleToken { $this->expired = $expired; return $this; @@ -147,20 +147,20 @@ class GoogleToken { /** * Get expired * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getExpired(): \DateTime { + public function getExpired(): \DateTimeImmutable { return $this->expired; } /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return GoogleToken */ - public function setCreated(\DateTime $created): GoogleToken { + public function setCreated(\DateTimeImmutable $created): GoogleToken { $this->created = $created; return $this; @@ -169,20 +169,20 @@ class GoogleToken { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return GoogleToken */ - public function setUpdated(\DateTime $updated): GoogleToken { + public function setUpdated(\DateTimeImmutable $updated): GoogleToken { $this->updated = $updated; return $this; @@ -191,9 +191,9 @@ class GoogleToken { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -257,7 +257,7 @@ class GoogleToken { //Check that we have an snippet instance if (($entity = $eventArgs->getObject()) instanceof GoogleToken) { //Set updated value - return $entity->setUpdated(new \DateTime('now')); + return $entity->setUpdated(new \DateTimeImmutable('now')); } } } diff --git a/Entity/Location.php b/Entity/Location.php index d70bddf..db76b03 100644 --- a/Entity/Location.php +++ b/Entity/Location.php @@ -32,12 +32,12 @@ class Location { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Sessions collection @@ -59,8 +59,8 @@ class Location { */ public function __construct(private string $title = '', private string $address = '', private string $zipcode = '0', private string $city = '', private string $latitude = '0', private string $longitude = '0', private bool $hotspot = false, private bool $indoor = false) { //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->sessions = new ArrayCollection(); @@ -278,11 +278,11 @@ class Location { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Location */ - public function setCreated(\DateTime $created): Location { + public function setCreated(\DateTimeImmutable $created): Location { $this->created = $created; return $this; @@ -291,20 +291,20 @@ class Location { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Location */ - public function setUpdated(\DateTime $updated): Location { + public function setUpdated(\DateTimeImmutable $updated): Location { $this->updated = $updated; return $this; @@ -313,9 +313,9 @@ class Location { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -432,7 +432,7 @@ class Location { //Check that we have a location instance if (($location = $eventArgs->getObject()) instanceof Location) { //Set updated value - $location->setUpdated(new \DateTime('now')); + $location->setUpdated(new \DateTimeImmutable('now')); } } diff --git a/Entity/Session.php b/Entity/Session.php index f74963c..8d89769 100644 --- a/Entity/Session.php +++ b/Entity/Session.php @@ -29,22 +29,22 @@ class Session { /** * Begin time */ - private ?\DateTime $begin = null; + private ?\DateTimeImmutable $begin = null; /** * Computed start datetime */ - private ?\DateTime $start = null; + private ?\DateTimeImmutable $start = null; /** * Length time */ - private ?\DateTime $length = null; + private ?\DateTimeImmutable $length = null; /** * Computed stop datetime */ - private ?\DateTime $stop = null; + private ?\DateTimeImmutable $stop = null; /** * Premium @@ -94,17 +94,17 @@ class Session { /** * Lock datetime */ - private ?\DateTime $locked = null; + private ?\DateTimeImmutable $locked = null; /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Application instance @@ -119,10 +119,10 @@ class Session { /** * Constructor */ - public function __construct(private \DateTime $date, private Location $location, private Slot $slot) { + public function __construct(private \DateTimeImmutable $date, private Location $location, private Slot $slot) { //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->applications = new ArrayCollection(); @@ -140,11 +140,11 @@ class Session { /** * Set date * - * @param \DateTime $date + * @param \DateTimeImmutable $date * * @return Session */ - public function setDate(\DateTime $date): Session { + public function setDate(\DateTimeImmutable $date): Session { $this->date = $date; return $this; @@ -153,20 +153,20 @@ class Session { /** * Get date * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getDate(): \DateTime { + public function getDate(): \DateTimeImmutable { return $this->date; } /** * Set begin * - * @param \DateTime $begin + * @param \DateTimeImmutable $begin * * @return Session */ - public function setBegin(?\DateTime $begin): Session { + public function setBegin(?\DateTimeImmutable $begin): Session { $this->begin = $begin; return $this; @@ -175,18 +175,18 @@ class Session { /** * Get begin * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getBegin(): ?\DateTime { + public function getBegin(): ?\DateTimeImmutable { return $this->begin; } /** * Get start * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getStart(): \DateTime { + public function getStart(): \DateTimeImmutable { //With start if ($this->start !== null) { return $this->start; @@ -215,11 +215,11 @@ class Session { /** * Set length * - * @param \DateTime $length + * @param \DateTimeImmutable $length * * @return Session */ - public function setLength(?\DateTime $length): Session { + public function setLength(?\DateTimeImmutable $length): Session { $this->length = $length; return $this; @@ -228,18 +228,18 @@ class Session { /** * Get length * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getLength(): ?\DateTime { + public function getLength(): ?\DateTimeImmutable { return $this->length; } /** * Get stop * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getStop(): \DateTime { + public function getStop(): \DateTimeImmutable { //Check start if ($this->stop !== null) { return $this->stop; @@ -459,11 +459,11 @@ class Session { /** * Set locked * - * @param \DateTime $locked + * @param \DateTimeImmutable $locked * * @return Session */ - public function setLocked(?\DateTime $locked): Session { + public function setLocked(?\DateTimeImmutable $locked): Session { $this->locked = $locked; return $this; @@ -472,20 +472,20 @@ class Session { /** * Get locked * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getLocked(): ?\DateTime { + public function getLocked(): ?\DateTimeImmutable { return $this->locked; } /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Session */ - public function setCreated(\DateTime $created): Session { + public function setCreated(\DateTimeImmutable $created): Session { $this->created = $created; return $this; @@ -494,20 +494,20 @@ class Session { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Session */ - public function setUpdated(\DateTime $updated): Session { + public function setUpdated(\DateTimeImmutable $updated): Session { $this->updated = $updated; return $this; @@ -516,9 +516,9 @@ class Session { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -626,7 +626,7 @@ class Session { //Check that we have a session instance if (($session = $eventArgs->getObject()) instanceof Session) { //Set updated value - $session->setUpdated(new \DateTime('now')); + $session->setUpdated(new \DateTimeImmutable('now')); } } diff --git a/Entity/Slot.php b/Entity/Slot.php index 25ef3e8..1977b93 100644 --- a/Entity/Slot.php +++ b/Entity/Slot.php @@ -27,12 +27,12 @@ class Slot { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Sessions collection @@ -44,8 +44,8 @@ class Slot { */ public function __construct(private string $title) { //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->sessions = new ArrayCollection(); @@ -85,11 +85,11 @@ class Slot { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Slot */ - public function setCreated(\DateTime $created) { + public function setCreated(\DateTimeImmutable $created) { $this->created = $created; return $this; @@ -98,20 +98,20 @@ class Slot { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Slot */ - public function setUpdated(\DateTime $updated) { + public function setUpdated(\DateTimeImmutable $updated) { $this->updated = $updated; return $this; @@ -120,9 +120,9 @@ class Slot { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -164,7 +164,7 @@ class Slot { //Check that we have a slot instance if (($slot = $eventArgs->getObject()) instanceof Slot) { //Set updated value - $slot->setUpdated(new \DateTime('now')); + $slot->setUpdated(new \DateTimeImmutable('now')); } } diff --git a/Entity/Snippet.php b/Entity/Snippet.php index dea8897..e645a69 100644 --- a/Entity/Snippet.php +++ b/Entity/Snippet.php @@ -70,12 +70,12 @@ class Snippet { /** * Create datetime */ - private \DateTime $created; + private \DateTimeImmutable $created; /** * Update datetime */ - private \DateTime $updated; + private \DateTimeImmutable $updated; /** * Constructor @@ -86,8 +86,8 @@ class Snippet { */ public function __construct(private string $locale, private Location $location, private User $user) { //Set defaults - $this->created = new \DateTime('now'); - $this->updated = new \DateTime('now'); + $this->created = new \DateTimeImmutable('now'); + $this->updated = new \DateTimeImmutable('now'); } /** @@ -321,11 +321,11 @@ class Snippet { /** * Set created * - * @param \DateTime $created + * @param \DateTimeImmutable $created * * @return Snippet */ - public function setCreated(\DateTime $created): Snippet { + public function setCreated(\DateTimeImmutable $created): Snippet { $this->created = $created; return $this; @@ -334,20 +334,20 @@ class Snippet { /** * Get created * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getCreated(): \DateTime { + public function getCreated(): \DateTimeImmutable { return $this->created; } /** * Set updated * - * @param \DateTime $updated + * @param \DateTimeImmutable $updated * * @return Snippet */ - public function setUpdated(\DateTime $updated): Snippet { + public function setUpdated(\DateTimeImmutable $updated): Snippet { $this->updated = $updated; return $this; @@ -356,9 +356,9 @@ class Snippet { /** * Get updated * - * @return \DateTime + * @return \DateTimeImmutable */ - public function getUpdated(): \DateTime { + public function getUpdated(): \DateTimeImmutable { return $this->updated; } @@ -413,7 +413,7 @@ class Snippet { //Check that we have an snippet instance if (($snippet = $eventArgs->getObject()) instanceof Snippet) { //Set updated value - $snippet->setUpdated(new \DateTime('now')); + $snippet->setUpdated(new \DateTimeImmutable('now')); } } }