diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 21a7ab295d2..ca10843c944 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -859,7 +859,13 @@ the following order: Service Subscriber Trait ------------------------ -The :class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` provides an +.. deprecated:: Contracts 3.5 + + The :class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` integration + is deprecated since Symfony contracts 3.5, it have been renamed to + :class:`ServiceMethodsSubscriberTrait` . + +The :class:`Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait` provides an implementation for :class:`Symfony\\Contracts\\Service\\ServiceSubscriberInterface` that looks through all methods in your class that are marked with the :class:`Symfony\\Contracts\\Service\\Attribute\\SubscribedService` attribute. It @@ -874,11 +880,11 @@ services based on type-hinted helper methods:: use Symfony\Component\Routing\RouterInterface; use Symfony\Contracts\Service\Attribute\SubscribedService; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait; + use ServiceMethodsSubscriberTrait; public function doSomething(): void { @@ -936,11 +942,11 @@ and compose your services with them:: namespace App\Service; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait, LoggerAware, RouterAware; + use ServiceMethodsSubscriberTrait, LoggerAware, RouterAware; public function doSomething(): void { @@ -978,11 +984,11 @@ Here's an example:: use Symfony\Component\Routing\RouterInterface; use Symfony\Contracts\Service\Attribute\SubscribedService; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait; + use ServiceMethodsSubscriberTrait; public function doSomething(): void {