Skip to content

Commit 8825bd7

Browse files
committed
ServiceSubscriberTrait is deprecated and replaced by ServiceMethodsSubscriberTrait
1 parent fb76821 commit 8825bd7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

service_container/service_subscribers_locators.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,13 @@ the following order:
859859
Service Subscriber Trait
860860
------------------------
861861

862-
The :class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` provides an
862+
.. deprecated:: Contracts 3.5
863+
864+
:class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` is deprecated
865+
since Symfony contracts 3.5, it have been renamed to
866+
:class:`Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait`.
867+
868+
The :class:`Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait` provides an
863869
implementation for :class:`Symfony\\Contracts\\Service\\ServiceSubscriberInterface`
864870
that looks through all methods in your class that are marked with the
865871
:class:`Symfony\\Contracts\\Service\\Attribute\\SubscribedService` attribute. It
@@ -874,11 +880,11 @@ services based on type-hinted helper methods::
874880
use Symfony\Component\Routing\RouterInterface;
875881
use Symfony\Contracts\Service\Attribute\SubscribedService;
876882
use Symfony\Contracts\Service\ServiceSubscriberInterface;
877-
use Symfony\Contracts\Service\ServiceSubscriberTrait;
883+
use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait;
878884

879885
class MyService implements ServiceSubscriberInterface
880886
{
881-
use ServiceSubscriberTrait;
887+
use ServiceMethodsSubscriberTrait;
882888

883889
public function doSomething(): void
884890
{
@@ -936,11 +942,11 @@ and compose your services with them::
936942
namespace App\Service;
937943

938944
use Symfony\Contracts\Service\ServiceSubscriberInterface;
939-
use Symfony\Contracts\Service\ServiceSubscriberTrait;
945+
use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait;
940946

941947
class MyService implements ServiceSubscriberInterface
942948
{
943-
use ServiceSubscriberTrait, LoggerAware, RouterAware;
949+
use ServiceMethodsSubscriberTrait, LoggerAware, RouterAware;
944950

945951
public function doSomething(): void
946952
{
@@ -978,11 +984,11 @@ Here's an example::
978984
use Symfony\Component\Routing\RouterInterface;
979985
use Symfony\Contracts\Service\Attribute\SubscribedService;
980986
use Symfony\Contracts\Service\ServiceSubscriberInterface;
981-
use Symfony\Contracts\Service\ServiceSubscriberTrait;
987+
use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait;
982988

983989
class MyService implements ServiceSubscriberInterface
984990
{
985-
use ServiceSubscriberTrait;
991+
use ServiceMethodsSubscriberTrait;
986992

987993
public function doSomething(): void
988994
{

0 commit comments

Comments
 (0)