diff --git a/src/Core/src/Admin/src/Entity/Admin.php b/src/Core/src/Admin/src/Entity/Admin.php index b9badb8..d24326a 100644 --- a/src/Core/src/Admin/src/Entity/Admin.php +++ b/src/Core/src/Admin/src/Entity/Admin.php @@ -226,7 +226,7 @@ public function getIdentifier(): string * lastName: string|null, * status: non-empty-string, * roles: iterable, - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null, * } */ diff --git a/src/Core/src/Admin/src/Entity/AdminLogin.php b/src/Core/src/Admin/src/Entity/AdminLogin.php index 870ddcf..1ced9af 100644 --- a/src/Core/src/Admin/src/Entity/AdminLogin.php +++ b/src/Core/src/Admin/src/Entity/AdminLogin.php @@ -296,7 +296,7 @@ public function setLoginStatus(SuccessFailureEnum $loginStatus): self * clientEngine: string|null, * clientVersion: string|null, * loginStatus: string, - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null, * } */ diff --git a/src/Core/src/App/src/Entity/EntityInterface.php b/src/Core/src/App/src/Entity/EntityInterface.php index 3b37b86..d4091b8 100644 --- a/src/Core/src/App/src/Entity/EntityInterface.php +++ b/src/Core/src/App/src/Entity/EntityInterface.php @@ -13,7 +13,7 @@ public function getId(): UuidInterface; public function getCreated(): ?DateTimeImmutable; - public function getCreatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): string; + public function getCreatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): ?string; public function getUpdated(): ?DateTimeImmutable; diff --git a/src/Core/src/App/src/Entity/RoleInterface.php b/src/Core/src/App/src/Entity/RoleInterface.php index 7c2c601..e554ade 100644 --- a/src/Core/src/App/src/Entity/RoleInterface.php +++ b/src/Core/src/App/src/Entity/RoleInterface.php @@ -11,7 +11,7 @@ * @phpstan-type RoleType array{ * id: non-empty-string, * name: non-empty-string, - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null * } */ diff --git a/src/Core/src/App/src/Entity/TimestampsTrait.php b/src/Core/src/App/src/Entity/TimestampsTrait.php index 0b6fa12..4485bea 100644 --- a/src/Core/src/App/src/Entity/TimestampsTrait.php +++ b/src/Core/src/App/src/Entity/TimestampsTrait.php @@ -10,7 +10,7 @@ trait TimestampsTrait { #[ORM\Column(name: 'created', type: 'datetime_immutable')] - protected DateTimeImmutable $created; + protected ?DateTimeImmutable $created = null; #[ORM\Column(name: 'updated', type: 'datetime_immutable', nullable: true)] protected ?DateTimeImmutable $updated = null; @@ -20,9 +20,9 @@ public function getCreated(): ?DateTimeImmutable return $this->created; } - public function getCreatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): string + public function getCreatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): ?string { - return $this->created->format($dateFormat); + return $this->created?->format($dateFormat); } public function getUpdated(): ?DateTimeImmutable @@ -32,11 +32,7 @@ public function getUpdated(): ?DateTimeImmutable public function getUpdatedFormatted(string $dateFormat = 'Y-m-d H:i:s'): ?string { - if ($this->updated instanceof DateTimeImmutable) { - return $this->updated->format($dateFormat); - } - - return null; + return $this->updated?->format($dateFormat); } #[ORM\PrePersist] diff --git a/src/Core/src/User/src/Entity/User.php b/src/Core/src/User/src/Entity/User.php index 0f3ba32..604748b 100644 --- a/src/Core/src/User/src/Entity/User.php +++ b/src/Core/src/User/src/Entity/User.php @@ -348,7 +348,7 @@ public function hasRoles(): bool * identity: non-empty-string|null, * status: non-empty-string, * roles: RoleType[], - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null, * } */ diff --git a/src/Core/src/User/src/Entity/UserAvatar.php b/src/Core/src/User/src/Entity/UserAvatar.php index ad37e16..f294ed5 100644 --- a/src/Core/src/User/src/Entity/UserAvatar.php +++ b/src/Core/src/User/src/Entity/UserAvatar.php @@ -16,7 +16,7 @@ * @phpstan-type UserAvatarType array{ * id: non-empty-string, * url: non-empty-string|null, - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null * } */ diff --git a/src/Core/src/User/src/Entity/UserDetail.php b/src/Core/src/User/src/Entity/UserDetail.php index a7ecfd6..f5fbdc8 100644 --- a/src/Core/src/User/src/Entity/UserDetail.php +++ b/src/Core/src/User/src/Entity/UserDetail.php @@ -17,7 +17,7 @@ * firstName: non-empty-string|null, * lastName: non-empty-string|null, * email: non-empty-string|null, - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null, * } */ diff --git a/src/Core/src/User/src/Entity/UserResetPassword.php b/src/Core/src/User/src/Entity/UserResetPassword.php index 9ad4507..3e8cd31 100644 --- a/src/Core/src/User/src/Entity/UserResetPassword.php +++ b/src/Core/src/User/src/Entity/UserResetPassword.php @@ -129,7 +129,7 @@ public function markAsCompleted(): self * expires: DateTimeImmutable, * hash: non-empty-string, * status: 'completed'|'requested', - * created: DateTimeImmutable, + * created: DateTimeImmutable|null, * updated: DateTimeImmutable|null * } */