From d4f305dcb93fef9a9a069fd01276c9832cbe4dc4 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 18 Jan 2023 18:49:53 +0100 Subject: [PATCH] [Clock] Fix `ClockAwareTrait` usage --- components/clock.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/clock.rst b/components/clock.rst index 608b1fbcec8..22768894cc9 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -114,11 +114,11 @@ the default one during tests, you will have full control to set the "current tim to any arbitrary date/time. In order to use this component in your services, make their classes use the -:class:`Symfony\\Component\\Clock\\ClockAwareTrait` and add a ``ClockInterface`` -typed-property ``$clock`` to their constructors. +:class:`Symfony\\Component\\Clock\\ClockAwareTrait`. Thanks to +:ref:`service autoconfiguration `, the ``setClock()`` method +of the trait will automatically be called by the service container. -If your application uses :ref:`service autoconfiguration `, -your services can now call the ``$this->now()`` method to get the current time:: +You can now call the ``$this->now()`` method to get the current time:: namespace App\TimeUtils;