This repository was archived by the owner on Mar 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Symfony \Component \EventDispatcher \Event ;
6
6
use Symfony \Component \EventDispatcher \EventDispatcher ;
7
- use Symfony \Component \EventDispatcher \Debug \ TraceableEventDispatcherInterface ;
7
+ use Symfony \Contracts \EventDispatcher \EventDispatcherInterface as ContractsEventDispatcherInterface ;
8
8
9
9
trait DispatcherWrapper
10
10
{
@@ -16,12 +16,12 @@ trait DispatcherWrapper
16
16
*/
17
17
protected function dispatch (EventDispatcher $ dispatcher , $ eventType , Event $ eventObject )
18
18
{
19
- //TraceableEventDispatcherInterface was introduced in symfony/event-dispatcher 2.5 and removed in 5.0
20
- if (! interface_exists (TraceableEventDispatcherInterface::class) ) {
21
- //Symfony 5
19
+ // The `EventDispatcherInterface` of `Symfony\Contracts` is only implemented in Symfony 4.3 or higher
20
+ if ($ dispatcher instanceof ContractsEventDispatcherInterface ) {
21
+ //Symfony 4.3 or higher
22
22
$ dispatcher ->dispatch ($ eventObject , $ eventType );
23
23
} else {
24
- //Symfony 2,3 or 4
24
+ //Symfony 4.2 or lower
25
25
$ dispatcher ->dispatch ($ eventType , $ eventObject );
26
26
}
27
27
You can’t perform that action at this time.
0 commit comments