1 | <?php |
||
16 | class Listener implements \SplSubject, \IteratorAggregate, \Countable |
||
17 | { |
||
18 | /** |
||
19 | * @var array of SplObjectStorage |
||
20 | */ |
||
21 | protected $observers = array(); |
||
22 | |||
23 | /** |
||
24 | * @var array of plugins |
||
25 | */ |
||
26 | protected static $plugins = array(); |
||
27 | |||
28 | /** |
||
29 | * Attaches a new observer |
||
30 | * |
||
31 | * @param \SplObserver $observer Any object implementing SplObserver |
||
32 | * @return void|false |
||
33 | */ |
||
34 | public function attach(\SplObserver $observer) |
||
43 | |||
44 | /** |
||
45 | * Detaches an existing observer |
||
46 | * |
||
47 | * @param \SplObserver $observer Any object implementing SplObserver |
||
48 | */ |
||
49 | public function detach(\SplObserver $observer) |
||
57 | |||
58 | /** |
||
59 | * Notifies all the observers |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | public function notify() |
||
69 | |||
70 | /** |
||
71 | * Gets the IteratorAggregate |
||
72 | * |
||
73 | * @return \Iterator |
||
74 | */ |
||
75 | public function getIterator() |
||
79 | |||
80 | /** |
||
81 | * Countable |
||
82 | * |
||
83 | * @return integer |
||
84 | */ |
||
85 | public function count() |
||
89 | |||
90 | /** |
||
91 | * Sets the plugins at the specified level |
||
92 | * |
||
93 | * @param array $key The level key |
||
94 | * @param array $plugins An array of plugins |
||
95 | * @return void |
||
96 | */ |
||
97 | public function setPluginsAtLevel($key, array $plugins) |
||
101 | |||
102 | /** |
||
103 | * Gets the plugins at the specified level |
||
104 | * |
||
105 | * @param string $key |
||
106 | * @return array|false An array of plugins |
||
107 | */ |
||
108 | public function getPluginsAtLevel($key) |
||
116 | |||
117 | /** |
||
118 | * Calls the plugins of the specified level and type |
||
119 | * |
||
120 | * @param string $level |
||
121 | * @param string $type |
||
122 | */ |
||
123 | public function hook($level, $type) |
||
134 | |||
135 | /** |
||
136 | * Calls and executes the plugin |
||
137 | * |
||
138 | * @param mix $plugin |
||
139 | * @param mix $args |
||
140 | */ |
||
141 | private function callPlugin($plugin, $args) |
||
155 | |||
156 | /** |
||
157 | * Load the specified plugin |
||
158 | * |
||
159 | * @param string $name The plugin name to load |
||
160 | * @param mix $mix The plugin options |
||
161 | * @return boolean True on success, false otherwise |
||
162 | * @throws RuntimeException If the plugin does not exists |
||
163 | * @throws DomainException If the plugin does not have a $hook property. |
||
164 | */ |
||
165 | public function loadPlugin($key, $mix = null) |
||
192 | |||
193 | /** |
||
194 | * Load all the plugins |
||
195 | * |
||
196 | * @param array $plugins The array of plugins to load |
||
197 | */ |
||
198 | public function loadPlugins(array $plugins) |
||
204 | |||
205 | } |
||
206 |
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: