Skip to content

Commit efb857d

Browse files
committed
minor #17772 [Clock] Fix ClockAwareTrait usage (alexandre-daubois)
This PR was merged into the 6.3 branch. Discussion ---------- [Clock] Fix `ClockAwareTrait` usage Commits ------- d4f305d [Clock] Fix `ClockAwareTrait` usage
2 parents de3bf84 + d4f305d commit efb857d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/clock.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ the default one during tests, you will have full control to set the "current tim
114114
to any arbitrary date/time.
115115

116116
In order to use this component in your services, make their classes use the
117-
:class:`Symfony\\Component\\Clock\\ClockAwareTrait` and add a ``ClockInterface``
118-
typed-property ``$clock`` to their constructors.
117+
:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. Thanks to
118+
:ref:`service autoconfiguration <services-autoconfigure>`, the ``setClock()`` method
119+
of the trait will automatically be called by the service container.
119120

120-
If your application uses :ref:`service autoconfiguration <services-autoconfigure>`,
121-
your services can now call the ``$this->now()`` method to get the current time::
121+
You can now call the ``$this->now()`` method to get the current time::
122122

123123
namespace App\TimeUtils;
124124

0 commit comments

Comments
 (0)