8000 [DI] Use classes from Contracts instead of the component by javiereguiluz · Pull Request #11664 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[DI] Use classes 8000 from Contracts instead of the component #11664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
15 changes: 7 additions & 8 deletions service_container/service_subscribers_locators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ a PSR-11 ``ContainerInterface``::
use App\CommandHandler\BarHandler;
use App\CommandHandler\FooHandler;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;

class CommandBus implements ServiceSu 8000 bscriberInterface
{
Expand Down Expand Up @@ -375,9 +375,8 @@ will share identical locators amongst all the services referencing them::
Service Subscriber Trait
------------------------

The :class:`Symfony\\Component\\DependencyInjection\\ServiceSubscriberTrait`
provides an implementation for
:class:`Symfony\\Component\\DependencyInjection\\ServiceSubscriberInterface`
The :class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` provides an
implementation for :class:`Symfony\\Contracts\\Service\\ServiceSubscriberInterface`
that looks through all methods in your class that have no arguments and a return
type. It provides a ``ServiceLocator`` for the services of those return types.
The service id is ``__METHOD__``. This allows you to add dependencies to your
Expand All @@ -387,9 +386,9 @@ services based on type-hinted helper methods::
namespace App\Service;

use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberTrait;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\Contracts\Service\ServiceSubscriberTrait;

class MyService implements ServiceSubscriberInterface
{
Expand Down Expand Up @@ -444,8 +443,8 @@ and compose your services with them::
// src/Service/MyService.php
namespace App\Service;

use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\DependencyInjection\ServiceSubscriberTrait;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
use Symfony\Contracts\Service\ServiceSubscriberTrait;

class MyService implements ServiceSubscriberInterface
{
Expand Down
0