Skip to content

Commit 2f9301c

Browse files
Merge branch '6.2' into 6.3
* 6.2: [Clock] Fix MockClock::modify() on PHP 8.3
2 parents c3f9b41 + eacea7f commit 2f9301c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Component/Clock/MockClock.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ public function sleep(float|int $seconds): void
5151

5252
public function modify(string $modifier): void
5353
{
54-
if (false === $modifiedNow = @$this->now->modify($modifier)) {
54+
try {
55+
$modifiedNow = @$this->now->modify($modifier);
56+
} catch (\DateMalformedStringException) {
57+
$modifiedNow = false;
58+
}
59+
if (false === $modifiedNow) {
5560
throw new \InvalidArgumentException(sprintf('Invalid modifier: "%s". Could not modify MockClock.', $modifier));
5661
}
5762

0 commit comments

Comments
 (0)