Skip to content

Commit 5427bd4

Browse files
committed
Update DateTimeImmutable to DateTimeInterface to Birthday VO
1 parent 502ea32 commit 5427bd4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Person/Birthday.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Myks92\ValueObjects\Person;
77

88
use DateTimeImmutable;
9+
use DateTimeInterface;
910
use Exception;
1011
use InvalidArgumentException;
1112

@@ -17,16 +18,16 @@
1718
class Birthday
1819
{
1920
/**
20-
* @var DateTimeImmutable
21+
* @var DateTimeInterface
2122
*/
22-
private DateTimeImmutable $date;
23+
private DateTimeInterface $date;
2324
/**
2425
*
25-
* @param DateTimeImmutable $date
26+
* @param DateTimeInterface $date
2627
*
2728
* @throws Exception
2829
*/
29-
public function __construct(DateTimeImmutable $date)
30+
public function __construct(DateTimeInterface $date)
3031
{
3132
$this->guard($date);
3233
$this->date = $date;
@@ -44,10 +45,10 @@ public function getAge(): Age
4445
}
4546

4647
/**
47-
* @return DateTimeImmutable
48+
* @return DateTimeInterface
4849
* @throws Exception
4950
*/
50-
public function getDate(): DateTimeImmutable
51+
public function getDate(): DateTimeInterface
5152
{
5253
return $this->date;
5354
}
@@ -73,11 +74,11 @@ public function isEqualTo(self $birthday): bool
7374
}
7475

7576
/**
76-
* @param DateTimeImmutable $date
77+
* @param DateTimeInterface $date
7778
*
7879
* @throws Exception
7980
*/
80-
private function guard(DateTimeImmutable $date): void
81+
private function guard(DateTimeInterface $date): void
8182
{
8283
$now = new DateTimeImmutable();
8384

0 commit comments

Comments
 (0)