Skip to content

Commit e8cf077

Browse files
committed
PHP 8.0 compatibility
1 parent f4c6125 commit e8cf077

File tree

2 files changed

+21
-33
lines changed

2 files changed

+21
-33
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626
],
2727
"require": {
28-
"php": ">=7.2",
28+
"php": ">=8.0",
2929
"symfony/framework-bundle": "^5.0",
3030
"symfony/config": "^5.0",
3131
"symfony/console": "^5.0",

src/Entity/ProcessLock.php

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,36 @@
55
namespace Webonaute\DoctrineDataLockingBundle\Entity;
66

77
use DateTime;
8+
use DateTimeImmutable;
9+
use DateTimeInterface;
810
use Doctrine\ORM\Mapping as ORM;
911

1012
/**
1113
* !!! You should put a index on at least the lockId and lockState.
12-
*
13-
* @ORM\Embeddable
1414
*/
15+
#[ORM\Embeddable]
1516
class ProcessLock
1617
{
17-
/**
18-
* @var string
19-
*
20-
* @ORM\Column(type="string", length=40, nullable=true)
21-
*/
22-
private $lockId;
18+
#[ORM\Column(type: 'string', length: 40, nullable: true)]
19+
private ?string $lockId = null;
2320

24-
/**
25-
* @var string
26-
*
27-
* @ORM\Column(type="string", length=40, nullable=true)
28-
*/
29-
private $lockState;
21+
#[ORM\Column(type: 'string', length: 40, nullable: true)]
22+
private ?string $lockState = null;
3023

3124
/**
32-
* @var DateTime
33-
*
34-
* @ORM\Column(type="datetime", nullable=true)
25+
* @var \DateTime|DateTimeImmutable|null
3526
*/
36-
private $lockedAt;
27+
#[ORM\Column(type: 'datetime', nullable: true)]
28+
private ?DateTimeInterface $lockedAt = null;
3729

3830
/**
3931
* Prevent locking before this date.
4032
*
41-
* @var DateTime
42-
*
43-
* @ORM\Column(name="lockingAt", type="datetime", nullable=true)
33+
* @var \DateTime|DateTimeImmutable|null
4434
*/
45-
private $lockingAt;
35+
#[ORM\Column(name: 'lockingAt', type: 'datetime', nullable: true)]
36+
private ?DateTimeInterface $lockingAt = null;
4637

47-
/**
48-
* @return null|string
49-
*/
5038
public function getLockId(): ?string
5139
{
5240
return $this->lockId;
@@ -61,17 +49,17 @@ public function setLockId(?string $lockId): void
6149
}
6250

6351
/**
64-
* @return null|DateTime
52+
* @return \DateTime|DateTimeImmutable|null
6553
*/
66-
public function getLockedAt(): ?DateTime
54+
public function getLockedAt(): ?DateTimeInterface
6755
{
6856
return $this->lockedAt;
6957
}
7058

7159
/**
7260
* @param DateTime $lockedAt
7361
*/
74-
public function setLockedAt(?DateTime $lockedAt): void
62+
public function setLockedAt(?DateTimeInterface $lockedAt): void
7563
{
7664
$this->lockedAt = $lockedAt;
7765
}
@@ -93,17 +81,17 @@ public function setLockState($lockState): void
9381
}
9482

9583
/**
96-
* @return null|DateTime
84+
* @return \DateTime|DateTimeImmutable|null
9785
*/
98-
public function getLockingAt(): ?DateTime
86+
public function getLockingAt(): ?DateTimeInterface
9987
{
10088
return $this->lockingAt;
10189
}
10290

10391
/**
104-
* @param null|DateTime $lockingAt
92+
* @param \DateTime|DateTimeImmutable|null $lockingAt
10593
*/
106-
public function setLockingAt(?DateTime $lockingAt): void
94+
public function setLockingAt(?DateTimeInterface $lockingAt): void
10795
{
10896
$this->lockingAt = $lockingAt;
10997
}

0 commit comments

Comments
 (0)