diff --git a/composer.json b/composer.json index f033c57..6d8e679 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ } ], "require": { - "php": ">=7.2", + "php": ">=8.0", "symfony/framework-bundle": "^5.0", "symfony/config": "^5.0", "symfony/console": "^5.0", diff --git a/src/Entity/ProcessLock.php b/src/Entity/ProcessLock.php index 19d4e37..60a41cc 100755 --- a/src/Entity/ProcessLock.php +++ b/src/Entity/ProcessLock.php @@ -5,48 +5,36 @@ namespace Webonaute\DoctrineDataLockingBundle\Entity; use DateTime; +use DateTimeImmutable; +use DateTimeInterface; use Doctrine\ORM\Mapping as ORM; /** * !!! You should put a index on at least the lockId and lockState. - * - * @ORM\Embeddable */ +#[ORM\Embeddable] class ProcessLock { - /** - * @var string - * - * @ORM\Column(type="string", length=40, nullable=true) - */ - private $lockId; + #[ORM\Column(type: 'string', length: 40, nullable: true)] + private ?string $lockId = null; - /** - * @var string - * - * @ORM\Column(type="string", length=40, nullable=true) - */ - private $lockState; + #[ORM\Column(type: 'string', length: 40, nullable: true)] + private ?string $lockState = null; /** - * @var DateTime - * - * @ORM\Column(type="datetime", nullable=true) + * @var \DateTime|DateTimeImmutable|null */ - private $lockedAt; + #[ORM\Column(type: 'datetime', nullable: true)] + private ?DateTimeInterface $lockedAt = null; /** * Prevent locking before this date. * - * @var DateTime - * - * @ORM\Column(name="lockingAt", type="datetime", nullable=true) + * @var \DateTime|DateTimeImmutable|null */ - private $lockingAt; + #[ORM\Column(name: 'lockingAt', type: 'datetime', nullable: true)] + private ?DateTimeInterface $lockingAt = null; - /** - * @return null|string - */ public function getLockId(): ?string { return $this->lockId; @@ -61,9 +49,9 @@ public function setLockId(?string $lockId): void } /** - * @return null|DateTime + * @return \DateTime|DateTimeImmutable|null */ - public function getLockedAt(): ?DateTime + public function getLockedAt(): ?DateTimeInterface { return $this->lockedAt; } @@ -71,7 +59,7 @@ public function getLockedAt(): ?DateTime /** * @param DateTime $lockedAt */ - public function setLockedAt(?DateTime $lockedAt): void + public function setLockedAt(?DateTimeInterface $lockedAt): void { $this->lockedAt = $lockedAt; } @@ -93,17 +81,17 @@ public function setLockState($lockState): void } /** - * @return null|DateTime + * @return \DateTime|DateTimeImmutable|null */ - public function getLockingAt(): ?DateTime + public function getLockingAt(): ?DateTimeInterface { return $this->lockingAt; } /** - * @param null|DateTime $lockingAt + * @param \DateTime|DateTimeImmutable|null $lockingAt */ - public function setLockingAt(?DateTime $lockingAt): void + public function setLockingAt(?DateTimeInterface $lockingAt): void { $this->lockingAt = $lockingAt; }