mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-23 16:22:10 +01:00
minor #21888 [EventDispatcher] Add missing use statement for CustomEvent in AsEven… (lacatoire)
This PR was merged into the 7.3 branch.
Discussion
----------
[EventDispatcher] Add missing use statement for CustomEvent in AsEven…
fixes #21002
Commits
-------
2a18b16f9 [EventDispatcher] Add missing use statement for CustomEvent in AsEventListener examples
This commit is contained in:
@@ -154,6 +154,7 @@ having to add any configuration in external files::
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use App\Event\CustomEvent;
|
||||
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
|
||||
|
||||
#[AsEventListener]
|
||||
@@ -172,6 +173,7 @@ doesn't explicitly define its method, so the ``onFoo()`` method will be called::
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use App\Event\CustomEvent;
|
||||
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
|
||||
|
||||
#[AsEventListener(event: CustomEvent::class, method: 'onCustomEvent')]
|
||||
@@ -200,6 +202,7 @@ can also be applied to methods directly::
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use App\Event\CustomEvent;
|
||||
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
|
||||
|
||||
final class MyMultiListener
|
||||
|
||||
Reference in New Issue
Block a user