mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-12 14:09:31 +00:00
Use DatetimeImmutable instead of DateTime wherever possible
This commit is contained in:
parent
eebc373734
commit
235d572f8c
39 changed files with 222 additions and 112 deletions
|
|
@ -117,10 +117,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected ?int $id = null;
|
||||
|
||||
#[Groups(['user:read'])]
|
||||
protected ?\DateTime $lastModified = null;
|
||||
protected ?\DateTimeImmutable $lastModified = null;
|
||||
|
||||
#[Groups(['user:read'])]
|
||||
protected ?\DateTime $addedDate = null;
|
||||
protected ?\DateTimeImmutable $addedDate = null;
|
||||
|
||||
/**
|
||||
* @var bool Determines if the user is disabled (user can not log in)
|
||||
|
|
@ -277,11 +277,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
#[Groups(['user:read', 'user:write'])]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
/** @var \DateTimeInterface|null The time when the backup codes were generated
|
||||
/** @var \DateTimeImmutable|null The time when the backup codes were generated
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
protected ?\DateTimeInterface $backupCodesGenerationDate = null;
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
protected ?\DateTimeImmutable $backupCodesGenerationDate = null;
|
||||
|
||||
/** @var Collection<int, LegacyU2FKeyInterface>
|
||||
*/
|
||||
|
|
@ -318,10 +318,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/**
|
||||
* @var \DateTime|null the time until the password reset token is valid
|
||||
* @var \DateTimeImmutable|null the time until the password reset token is valid
|
||||
*/
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
protected ?\DateTime $pw_reset_expires = null;
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
protected ?\DateTimeImmutable $pw_reset_expires = null;
|
||||
|
||||
/**
|
||||
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
|
||||
|
|
@ -528,7 +528,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Gets the datetime when the password reset token expires.
|
||||
*/
|
||||
public function getPwResetExpires(): \DateTimeInterface|null
|
||||
public function getPwResetExpires(): \DateTimeImmutable|null
|
||||
{
|
||||
return $this->pw_reset_expires;
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the datetime when the password reset token expires.
|
||||
*/
|
||||
public function setPwResetExpires(\DateTime $pw_reset_expires): self
|
||||
public function setPwResetExpires(\DateTimeImmutable $pw_reset_expires): self
|
||||
{
|
||||
$this->pw_reset_expires = $pw_reset_expires;
|
||||
|
||||
|
|
@ -897,7 +897,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
public function setBackupCodes(array $codes): self
|
||||
{
|
||||
$this->backupCodes = $codes;
|
||||
$this->backupCodesGenerationDate = $codes === [] ? null : new DateTime();
|
||||
$this->backupCodesGenerationDate = $codes === [] ? null : new \DateTimeImmutable();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -905,7 +905,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Return the date when the backup codes were generated.
|
||||
*/
|
||||
public function getBackupCodesGenerationDate(): ?\DateTimeInterface
|
||||
public function getBackupCodesGenerationDate(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->backupCodesGenerationDate;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue