Skip to content

Commit d9cb18a

Browse files
[Clock] Fix ClockAwareTrait usage
1 parent bbaf5b0 commit d9cb18a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

components/clock.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,10 @@ 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.
119-
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::
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.
120+
You can now call the ``$this->now()`` method to get the current time::
122121

123122
namespace App\TimeUtils;
124123

0 commit comments

Comments
 (0)