|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the doyo/behat-coverage-extension project. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Anthonius Munthi <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Doyo\Behat\Coverage\Bridge\Symfony; |
|
15
|
|
|
|
|
16
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyEventDispatcher; |
|
17
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Maintain backward compatibility with symfony version. |
|
21
|
|
|
*/ |
|
22
|
|
|
class EventDispatcher |
|
23
|
|
|
{ |
|
24
|
|
|
private $version = '4.2'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var SymfonyEventDispatcher |
|
28
|
|
|
*/ |
|
29
|
|
|
private $dispatcher; |
|
30
|
|
|
|
|
31
|
|
|
public function __construct() |
|
32
|
|
|
{ |
|
33
|
|
|
$dispatcher = new SymfonyEventDispatcher(); |
|
34
|
|
|
$r = new \ReflectionObject($dispatcher); |
|
35
|
|
|
$params = $r->getMethod('dispatch')->getParameters(); |
|
36
|
|
|
|
|
37
|
|
|
if ('event' === $params[0]->getName()) { |
|
38
|
|
|
$this->version = '4.3'; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
$this->dispatcher = $dispatcher; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function addSubscriber(EventSubscriberInterface $subscriber) |
|
45
|
|
|
{ |
|
46
|
|
|
$this->dispatcher->addSubscriber($subscriber); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param Event $event |
|
51
|
|
|
* @param string $eventName |
|
52
|
|
|
* |
|
53
|
|
|
* @return \Symfony\Component\EventDispatcher\Event|\Symfony\Contract\EventDispatcher\Event |
|
|
|
|
|
|
54
|
|
|
*/ |
|
55
|
|
|
public function dispatch($event, $eventName = null) |
|
56
|
|
|
{ |
|
57
|
|
|
$dispatcher = $this->dispatcher; |
|
58
|
|
|
if ('4.2' === $this->version) { |
|
59
|
|
|
return $dispatcher->dispatch($eventName, $event); |
|
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
return $dispatcher->dispatch($event, $eventName); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths