1 | <?php |
||
31 | class Dispatcher extends EventDispatcher |
||
32 | { |
||
33 | /** @var Dispatcher[] Keep track of an array of instances. */ |
||
34 | protected static $instances = []; |
||
35 | |||
36 | /** |
||
37 | * Override constructor to make this singleton. |
||
38 | * @codeCoverageIgnore For some reason |
||
39 | */ |
||
40 | protected function __construct() |
||
41 | { |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Returns a named instance of the Event Dispatcher. |
||
46 | */ |
||
47 | 5 | public static function getInstance(string $name = 'default'): self |
|
55 | |||
56 | /** |
||
57 | * Sets a names instance of the Event Dispatcher. |
||
58 | */ |
||
59 | 1 | public static function setInstance(string $name, self $instance): void |
|
63 | } |
||
64 |
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: