1 | <?php |
||
47 | abstract class AbstractItemList implements ItemListInterface |
||
48 | { |
||
49 | /** |
||
50 | * Items |
||
51 | * |
||
52 | * @var ItemInterface[] |
||
53 | */ |
||
54 | protected $items; |
||
55 | |||
56 | /** |
||
57 | * Internal pointer |
||
58 | * |
||
59 | * @var int |
||
60 | */ |
||
61 | protected $pointer; |
||
62 | |||
63 | /** |
||
64 | * ItemList constructor |
||
65 | * |
||
66 | * @param ItemInterface[] $items Items |
||
67 | * @api |
||
68 | */ |
||
69 | 6 | public function __construct(array $items = []) |
|
74 | |||
75 | /** |
||
76 | * Return the current item |
||
77 | * |
||
78 | * @return ItemInterface Item |
||
79 | * @api |
||
80 | */ |
||
81 | public function current() |
||
85 | |||
86 | /** |
||
87 | * Move forward to next element |
||
88 | * |
||
89 | * @return void |
||
90 | * @api |
||
91 | */ |
||
92 | public function next() |
||
96 | |||
97 | /** |
||
98 | * Return the position of the current element |
||
99 | * |
||
100 | * @return int Position of the current element |
||
101 | * @api |
||
102 | */ |
||
103 | public function key() |
||
107 | |||
108 | /** |
||
109 | * Checks if current position is valid |
||
110 | * |
||
111 | * @return boolean The current position is valid |
||
112 | * @api |
||
113 | */ |
||
114 | public function valid() |
||
118 | |||
119 | /** |
||
120 | * Rewind the item list to the first element |
||
121 | * |
||
122 | * @return void |
||
123 | * @api |
||
124 | */ |
||
125 | public function rewind() |
||
129 | |||
130 | /** |
||
131 | * Return a JSON representation of the item list |
||
132 | * |
||
133 | * @return string Item list JSON |
||
134 | * @api |
||
135 | */ |
||
136 | 1 | public function toJson() |
|
140 | |||
141 | /** |
||
142 | * Return an object representation of the item list |
||
143 | * |
||
144 | * @return \stdClass Micro information items |
||
145 | * @api |
||
146 | */ |
||
147 | public function toObject() |
||
157 | |||
158 | /** |
||
159 | * Return the first item, optionally of particular types |
||
160 | * |
||
161 | * @param array ...$types Item types |
||
162 | * @return ItemInterface Item |
||
163 | * @throws OutOfBoundsException If there are no matching items |
||
164 | * @api |
||
165 | */ |
||
166 | 1 | public function getFirstItem(...$types) |
|
180 | |||
181 | /** |
||
182 | * Return all items as an array, optionally filtered by item type(s) |
||
183 | * |
||
184 | * @param array ...$types Item types |
||
185 | * @return ItemInterface[] Items matching the requested types |
||
186 | * @api |
||
187 | */ |
||
188 | 1 | public function getItems(...$types) |
|
202 | } |
||
203 |
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: