1 | <?php |
||
48 | class ItemList implements ItemListInterface |
||
49 | { |
||
50 | /** |
||
51 | * Items |
||
52 | * |
||
53 | * @var ItemInterface[] |
||
54 | */ |
||
55 | protected $items; |
||
56 | |||
57 | /** |
||
58 | * Internal pointer |
||
59 | * |
||
60 | * @var int |
||
61 | */ |
||
62 | protected $pointer; |
||
63 | |||
64 | /** |
||
65 | * ItemList constructor |
||
66 | * |
||
67 | * @param ItemInterface[] $items Items |
||
68 | * @api |
||
69 | */ |
||
70 | 9 | public function __construct(array $items = []) |
|
75 | |||
76 | /** |
||
77 | * Return the current item |
||
78 | * |
||
79 | * @return ItemInterface Item |
||
80 | * @api |
||
81 | */ |
||
82 | 1 | public function current() |
|
86 | |||
87 | /** |
||
88 | * Move forward to next element |
||
89 | * |
||
90 | * @return void |
||
91 | * @api |
||
92 | */ |
||
93 | 1 | public function next() |
|
97 | |||
98 | /** |
||
99 | * Return the position of the current element |
||
100 | * |
||
101 | * @return int Position of the current element |
||
102 | * @api |
||
103 | */ |
||
104 | public function key() |
||
108 | |||
109 | /** |
||
110 | * Checks if current position is valid |
||
111 | * |
||
112 | * @return boolean The current position is valid |
||
113 | * @api |
||
114 | */ |
||
115 | 1 | public function valid() |
|
119 | |||
120 | /** |
||
121 | * Rewind the item list to the first element |
||
122 | * |
||
123 | * @return void |
||
124 | * @api |
||
125 | */ |
||
126 | 1 | public function rewind() |
|
130 | |||
131 | /** |
||
132 | * Return a JSON representation of the item list |
||
133 | * |
||
134 | * @return string Item list JSON |
||
135 | * @api |
||
136 | */ |
||
137 | public function toJson() |
||
141 | |||
142 | /** |
||
143 | * Return an object representation of the item list |
||
144 | * |
||
145 | * @return \stdClass Micro information items |
||
146 | * @api |
||
147 | */ |
||
148 | public function toObject() |
||
158 | |||
159 | /** |
||
160 | * Return the first item, optionally of particular types |
||
161 | * |
||
162 | * @param array ...$types Item types |
||
163 | * @return ItemInterface Item |
||
164 | * @throws OutOfBoundsException If there are no matching items |
||
165 | * @api |
||
166 | */ |
||
167 | 2 | public function getFirstItem(...$types) |
|
181 | |||
182 | /** |
||
183 | * Return all items as an array, optionally filtered by item type(s) |
||
184 | * |
||
185 | * @param array ...$types Item types |
||
186 | * @return ItemInterface[] Items matching the requested types |
||
187 | * @api |
||
188 | */ |
||
189 | 3 | public function getItems(...$types) |
|
203 | |||
204 | /** |
||
205 | * Return the number of items in this list |
||
206 | * |
||
207 | * @return int Number of items |
||
208 | * @api |
||
209 | */ |
||
210 | 1 | public function count() |
|
214 | |||
215 | /** |
||
216 | * Generic item getter |
||
217 | * |
||
218 | * @param string $type Item type |
||
219 | * @param array $arguments Arguments |
||
220 | * @return ItemInterface Item |
||
221 | * @throws InvalidArgumentException If the item index is invalid |
||
222 | * @api |
||
223 | */ |
||
224 | 2 | public function __call($type, $arguments) |
|
242 | |||
243 | /** |
||
244 | * Return an item by type and index |
||
245 | * |
||
246 | * @param string $type Item type |
||
247 | * @param int $index Item index |
||
248 | * @return ItemInterface Item |
||
249 | * @throws OutOfBoundsException If the item index is out of bounds |
||
250 | */ |
||
251 | 2 | protected function getItemByTypeAndIndex($type, $index) |
|
266 | } |
||
267 |
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: