7272
7373When an event is dispatched, it's identified by a unique name (e.g.
7474``kernel.response ``), which any number of listeners might be listening to.
75- An :class: `Symfony\\ Component \\ EventDispatcher\\ Event ` instance is also
75+ An :class: `Symfony\\ Contracts \\ EventDispatcher\\ Event ` instance is also
7676created and passed to all of the listeners. As you'll see later, the ``Event ``
7777object itself often contains data about the event being dispatched.
7878
@@ -161,7 +161,7 @@ The ``addListener()`` method takes up to three arguments:
161161 So far, you've seen how PHP objects can be registered as listeners.
162162 You can also register PHP `Closures `_ as event listeners::
163163
164- use Symfony\Component \EventDispatcher\Event;
164+ use Symfony\Contracts \EventDispatcher\Event;
165165
166166 $dispatcher->addListener('acme.foo.action', function (Event $event) {
167167 // will be executed when the acme.foo.action event is dispatched
@@ -172,7 +172,7 @@ is notified. In the above example, when the ``acme.foo.action`` event is dispatc
172172the dispatcher calls the ``AcmeListener::onFooAction() `` method and passes
173173the ``Event `` object as the single argument::
174174
175- use Symfony\Component \EventDispatcher\Event;
175+ use Symfony\Contracts \EventDispatcher\Event;
176176
177177 class AcmeListener
178178 {
@@ -252,7 +252,7 @@ order. Start by creating this custom event class and documenting it::
252252 namespace Acme\Store\Event;
253253
254254 use Acme\Store\Order;
255- use Symfony\Component \EventDispatcher\Event;
255+ use Symfony\Contracts \EventDispatcher\Event;
256256
257257 /**
258258 * The order.placed event is dispatched each time an order is created
@@ -281,7 +281,7 @@ Each listener now has access to the order via the ``getOrder()`` method.
281281
282282 If you don't need to pass any additional data to the event listeners, you
283283 can also use the default
284- :class: `Symfony\\ Component \\ EventDispatcher\\ Event ` class. In such case,
284+ :class: `Symfony\\ Contracts \\ EventDispatcher\\ Event ` class. In such case,
285285 you can document the event and its name in a generic ``StoreEvents `` class,
286286 similar to the :class: `Symfony\\ Component\\ HttpKernel\\ KernelEvents `
287287 class.
@@ -419,7 +419,7 @@ Now, any listeners to ``order.placed`` that have not yet been called will
419419*not * be called.
420420
421421It is possible to detect if an event was stopped by using the
422- :method: `Symfony\\ Component \\ EventDispatcher\\ Event::isPropagationStopped `
422+ :method: `Symfony\\ Contracts \\ EventDispatcher\\ Event::isPropagationStopped `
423423method which returns a boolean value::
424424
425425 // ...
@@ -450,7 +450,7 @@ Dispatcher Shortcuts
450450~~~~~~~~~~~~~~~~~~~~
451451
452452If you do not need a custom event object, you can rely on a plain
453- :class: `Symfony\\ Component \\ EventDispatcher\\ Event ` object. You do not even
453+ :class: `Symfony\\ Contracts \\ EventDispatcher\\ Event ` object. You do not even
454454need to pass this to the dispatcher as it will create one by default unless you
455455specifically pass one::
456456
@@ -482,8 +482,8 @@ Event Name Introspection
482482The ``EventDispatcher `` instance, as well as the name of the event that
483483is dispatched, are passed as arguments to the listener::
484484
485- use Symfony\Component \EventDispatcher\Event;
486- use Symfony\Component \EventDispatcher\EventDispatcherInterface;
485+ use Symfony\Contracts \EventDispatcher\Event;
486+ use Symfony\Contracts \EventDispatcher\EventDispatcherInterface;
487487
488488 class Foo
489489 {
0 commit comments