1 | <?php |
||
36 | class Roster extends Component implements \IteratorAggregate, \ArrayAccess |
||
37 | { |
||
38 | use BetterEmitter, Accessors; |
||
39 | |||
40 | private $_items = []; |
||
41 | |||
42 | 5 | public function setClient(XmppClient $client) |
|
61 | |||
62 | 3 | private function handleSet(Iq\Query\Roster $query) |
|
74 | |||
75 | 3 | private function handleResult(Iq\Query\Roster $query) |
|
84 | |||
85 | /** |
||
86 | * Whether a offset exists |
||
87 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
88 | * @param mixed $offset <p> |
||
89 | * An offset to check for. |
||
90 | * </p> |
||
91 | * @return boolean true on success or false on failure. |
||
92 | * </p> |
||
93 | * <p> |
||
94 | * The return value will be casted to boolean if non-boolean was returned. |
||
95 | * @since 5.0.0 |
||
96 | */ |
||
97 | public function offsetExists($offset) |
||
101 | |||
102 | /** |
||
103 | * Offset to retrieve |
||
104 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
105 | * @param mixed $offset <p> |
||
106 | * The offset to retrieve. |
||
107 | * </p> |
||
108 | * @return mixed Can return all value types. |
||
109 | * @since 5.0.0 |
||
110 | */ |
||
111 | 1 | public function offsetGet($offset) |
|
112 | { |
||
113 | 1 | return clone ($this->_items[(string)$offset] ?? null); |
|
114 | } |
||
115 | |||
116 | /** |
||
117 | * Offset to set |
||
118 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
119 | * @param mixed $offset <p> |
||
120 | * The offset to assign the value to. |
||
121 | * </p> |
||
122 | * @param mixed $value <p> |
||
123 | * The value to set. |
||
124 | * </p> |
||
125 | * @return void |
||
126 | * @since 5.0.0 |
||
127 | */ |
||
128 | public function offsetSet($offset, $value) |
||
132 | |||
133 | /** |
||
134 | * Offset to unset |
||
135 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
136 | * @param mixed $offset <p> |
||
137 | * The offset to unset. |
||
138 | * </p> |
||
139 | * @return void |
||
140 | * @since 5.0.0 |
||
141 | */ |
||
142 | public function offsetUnset($offset) |
||
146 | |||
147 | 1 | public function remove($what) |
|
160 | |||
161 | 2 | public function update(Iq\Query\Roster\Item $item) |
|
168 | |||
169 | 1 | public function add(Iq\Query\Roster\Item $item) |
|
173 | |||
174 | /** |
||
175 | * Retrieve an external iterator |
||
176 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
177 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
178 | * <b>Traversable</b> |
||
179 | * @since 5.0.0 |
||
180 | */ |
||
181 | public function getIterator(): Traversable |
||
185 | |||
186 | /** |
||
187 | * @return Iq\Query\Roster\Item[] |
||
188 | */ |
||
189 | 1 | public function getItems() |
|
193 | |||
194 | public static function group($name) |
||
198 | |||
199 | /** |
||
200 | * @param callable(Item $item) $mapper |
||
201 | * @return array |
||
202 | */ |
||
203 | public function map(callable $mapper) |
||
207 | |||
208 | /** |
||
209 | * @param callable $predicate |
||
210 | * @return Iq\Query\Roster\Item[] |
||
211 | */ |
||
212 | public function filter(callable $predicate) |
||
216 | |||
217 | public function asArray() : array |
||
221 | |||
222 | public static function fromArray(array $array) |
||
226 | |||
227 | /** |
||
228 | * Count elements of an object |
||
229 | * @link http://php.net/manual/en/countable.count.php |
||
230 | * @return int The custom count as an integer. |
||
231 | * </p> |
||
232 | * <p> |
||
233 | * The return value is cast to an integer. |
||
234 | * @since 5.1.0 |
||
235 | */ |
||
236 | public function count() |
||
240 | |||
241 | |||
242 | 3 | private function setItem(Iq\Query\Roster\Item $item) |
|
247 | |||
248 | private function removeItem(Jid $jid) |
||
260 | } |
||
261 |
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: