OSDN Git Service

Добавление Мест размещения и регионов (подразделений)
[invent/invent.git] / vendor / codeception / phpunit-wrapper / src / DispatcherWrapper.php
1 <?php
2
3 namespace Codeception\PHPUnit;
4
5 use Symfony\Component\EventDispatcher\Event;
6 use Symfony\Component\EventDispatcher\EventDispatcher;
7 use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
8
9 trait DispatcherWrapper
10 {
11     /**
12      * Compatibility wrapper for dispatcher change between Symfony 4 and 5
13      * @param EventDispatcher $dispatcher
14      * @param string $eventType
15      * @param Event $eventObject
16      */
17     protected function dispatch(EventDispatcher $dispatcher, $eventType, Event $eventObject)
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
22             $dispatcher->dispatch($eventObject, $eventType);
23         } else {
24             //Symfony 2,3 or 4
25             $dispatcher->dispatch($eventType, $eventObject);
26         }
27
28     }
29 }