8000 [Clock] Add $modifier argument to now() helper · symfony/symfony@489183a · GitHub
[go: up one dir, main page]

Skip to content

Commit 489183a

Browse files
[Clock] Add $modifier argument to now() helper
1 parent d6d233b commit 489183a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Symfony/Component/Clock/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.4
5+
---
6+
7+
* Add $modifier argument to now() helper
8+
49
6.3
510
---
611

src/Symfony/Component/Clock/Resources/now.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
* Note that you should prefer injecting a ClockInterface or using
1919
* ClockAwareTrait when possible instead of using this function.
2020
*/
21-
function now(): \DateTimeImmutable
21+
function now(string $modifier = null): \DateTimeImmutable
2222
{
23+
if (null !== $modifier) {
24+
return Clock::get()->now()->modify($modifier);
25+
}
26+
2327
return Clock::get()->now();
2428
}
2529
}

0 commit comments

Comments
 (0)
0