Skip to content

Commit 7361374

Browse files
[Clock] Fix MockClock::modify() on PHP 8.3
1 parent e6e1e26 commit 7361374

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
@@ -49,7 +49,12 @@ public function sleep(float|int $seconds): void
4949

5050
public function modify(string $modifier): void
5151
{
52-
if (false === $modifiedNow = @$this->now->modify($modifier)) {
52+
try {
53+
$modifiedNow = @$this->now->modify($modifier);
54+
} catch (\DateMalformedStringException) {
55+
$modifiedNow = false;
56+
}
57+
if (false === $modifiedNow) {
5358
throw new \InvalidArgumentException(sprintf('Invalid modifier: "%s". Could not modify MockClock.', $modifier));
5459
}
5560

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy