1 | <?php |
||
8 | trait EventEmitterTrait |
||
9 | { |
||
10 | protected $listeners = []; |
||
11 | |||
12 | /** |
||
13 | * @param string $eventName |
||
14 | * @param callable $listener |
||
15 | */ |
||
16 | public function addListener($eventName, callable $listener) |
||
24 | |||
25 | /** |
||
26 | * @param string $eventName |
||
27 | * @param callable $listener |
||
28 | */ |
||
29 | public function removeListener($eventName, callable $listener) |
||
37 | |||
38 | /** |
||
39 | * @param string|null $eventName |
||
40 | */ |
||
41 | public function removeAllListeners($eventName = null) |
||
49 | |||
50 | /** |
||
51 | * @param string $eventName |
||
52 | * @param Event $event |
||
53 | */ |
||
54 | public function emit($eventName, Event $event = null) |
||
66 | |||
67 | /** |
||
68 | * @param string $eventName |
||
69 | * @return array |
||
70 | */ |
||
71 | public function listeners($eventName) |
||
75 | |||
76 | /** |
||
77 | * @param string $eventName |
||
78 | * @param Event $event |
||
79 | */ |
||
80 | private function runListeners($eventName, Event $event) |
||
89 | } |
||
90 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: