doyolabs /
behat-code-coverage
| 1 | <?php |
||
| 2 | |||
| 3 | |||
| 4 | namespace Doyo\Behat\Coverage\Bridge\Symfony; |
||
| 5 | |||
| 6 | use Symfony\Component\EventDispatcher\EventDispatcher as BaseEventDispatcher; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Maintain backward compatibility with symfony version |
||
| 10 | * |
||
| 11 | * @package Doyo\Behat\Coverage\Bridge\Symfony |
||
| 12 | */ |
||
| 13 | class EventDispatcher extends BaseEventDispatcher |
||
| 14 | { |
||
| 15 | private $version = '4.2'; |
||
| 16 | |||
| 17 | 1 | public function __construct() |
|
| 18 | { |
||
| 19 | 1 | parent::__construct(); |
|
| 20 | |||
| 21 | 1 | $r = new \ReflectionClass('\Symfony\Component\EventDispatcher\EventDispatcher'); |
|
| 22 | 1 | $params = $r->getMethod('dispatch')->getParameters(); |
|
| 23 | 1 | if('event' === $params[0]->getName()){ |
|
| 24 | 1 | $this->version = '4.3'; |
|
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param Event $event |
||
| 30 | * @param string $eventName |
||
| 31 | * |
||
| 32 | * @return Event |
||
| 33 | */ |
||
| 34 | 1 | public function dispatch($event, $eventName = null) |
|
| 35 | { |
||
| 36 | 1 | if('4.2' === $this->version){ |
|
| 37 | return parent::dispatch($eventName, $event); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 38 | } |
||
| 39 | 1 | return parent::dispatch($event, $eventName); |
|
| 40 | } |
||
| 41 | } |
||
| 42 |