1 | <?php |
||
5 | class EventListener |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | public $event; |
||
11 | |||
12 | /** |
||
13 | * @var callable |
||
14 | */ |
||
15 | public $handler; |
||
16 | |||
17 | /** |
||
18 | * @var callable |
||
19 | */ |
||
20 | public $listener; |
||
21 | |||
22 | /** |
||
23 | * @var EventEmitterInterface |
||
24 | */ |
||
25 | private $emitter; |
||
26 | |||
27 | /** |
||
28 | * @param EventEmitterInterface $emitter |
||
29 | * @param string $event |
||
30 | * @param callable $handler |
||
31 | * @param callable|null $listener |
||
32 | */ |
||
33 | 107 | public function __construct(EventEmitterInterface $emitter, $event, callable $handler, callable $listener = null) |
|
40 | |||
41 | /** |
||
42 | * |
||
43 | */ |
||
44 | 97 | public function __destruct() |
|
51 | |||
52 | /** |
||
53 | * @return EventEmitterInterface |
||
54 | */ |
||
55 | 25 | public function getEmitter() |
|
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | 26 | public function getEvent() |
|
67 | |||
68 | /** |
||
69 | * @return callable|null |
||
70 | */ |
||
71 | 18 | public function getHandler() |
|
75 | |||
76 | /** |
||
77 | * @return callable |
||
78 | */ |
||
79 | public function getListener() |
||
83 | |||
84 | /** |
||
85 | * |
||
86 | */ |
||
87 | 1 | public function cancel() |
|
94 | } |
||
95 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.