Skip to content

Commit

Permalink
PHP 8.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemBrovko committed May 25, 2022
1 parent f4c6125 commit e8cf077
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 33 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=8.0",
"symfony/framework-bundle": "^5.0",
"symfony/config": "^5.0",
"symfony/console": "^5.0",
Expand Down
52 changes: 20 additions & 32 deletions src/Entity/ProcessLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,17 +49,17 @@ public function setLockId(?string $lockId): void
}

/**
* @return null|DateTime
* @return \DateTime|DateTimeImmutable|null
*/
public function getLockedAt(): ?DateTime
public function getLockedAt(): ?DateTimeInterface
{
return $this->lockedAt;
}

/**
* @param DateTime $lockedAt
*/
public function setLockedAt(?DateTime $lockedAt): void
public function setLockedAt(?DateTimeInterface $lockedAt): void
{
$this->lockedAt = $lockedAt;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit e8cf077

Please sign in to comment.