Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 17415c6

Browse filesBrowse files
committed
bug #51190 [Clock] load function only if not loaded before (xabbuh)
This PR was merged into the 6.3 branch. Discussion ---------- [Clock] load function only if not loaded before | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #51180 | License | MIT | Doc PR | We do the same for functions defined in the String, Translation and VarDumper components. Commits ------- 6b88ea7 load function only if not loaded before
2 parents e804806 + 6b88ea7 commit 17415c6
Copy full SHA for 17415c6

File tree

1 file changed

+11
-9
lines changed
Filter options
  • src/Symfony/Component/Clock/Resources

1 file changed

+11
-9
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Clock/Resources/now.php
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
namespace Symfony\Component\Clock;
1313

14-
/**
15-
* Returns the current time as a DateTimeImmutable.
16-
*
17-
* Note that you should prefer injecting a ClockInterface or using
18-
* ClockAwareTrait when possible instead of using this function.
19-
*/
20-
function now(): \DateTimeImmutable
21-
{
22-
return Clock::get()->now();
14+
if (!\function_exists(now::class)) {
15+
/**
16+
* Returns the current time as a DateTimeImmutable.
17+
*
18+
* Note that you should prefer injecting a ClockInterface or using
19+
* ClockAwareTrait when possible instead of using this function.
20+
*/
21+
function now(): \DateTimeImmutable
22+
{
23+
return Clock::get()->now();
24+
}
2325
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.