From 8c6912b74aae7e2c0830a34794512040b541d3af Mon Sep 17 00:00:00 2001 From: Erdal G Date: Sun, 21 Feb 2021 11:03:54 +0100 Subject: [PATCH] Minor change to use DateTimeImmutable instead of DateTime Using DateTimeImmutable instead of DateTime when no mutation is needed improves performances. --- doctrine/events.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctrine/events.rst b/doctrine/events.rst index c98be25d736..30b48856c13 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -76,7 +76,7 @@ define a callback for the ``prePersist`` Doctrine event: */ public function setCreatedAtValue(): void { - $this->createdAt = new \DateTime(); + $this->createdAt = new \DateTimeImmutable(); } }