@@ -205,6 +205,134 @@ class FilterIterator extends IteratorIterator {
205
205
}
206
206
207
207
208
+ /**
209
+ * @template-covariant TKey
210
+ * @template-covariant TValue
211
+ *
212
+ * @template-implements OuterIterator<TKey, TValue>
213
+ * @template-implements ArrayAccess<TKey, TValue>
214
+ *
215
+ * @template-extends IteratorIterator<TKey, TValue>
216
+ */
217
+ class CachingIterator extends IteratorIterator implements OuterIterator , ArrayAccess , Countable {
218
+ /**
219
+ * @param Iterator<TKey, TValue> $iterator
220
+ */
221
+ public function __construct(Iterator $iterator) {}
222
+
223
+ /** @return bool */
224
+ public function hasNext () {}
225
+
226
+ /**
227
+ * @return TValue Can return any type.
228
+ */
229
+ public function current() {}
230
+
231
+ /**
232
+ * @return TKey scalar on success, or null on failure.
233
+ */
234
+ public function key() {}
235
+ }
236
+
237
+ /**
238
+ * @template-covariant TKey
239
+ * @template-covariant TValue
240
+ *
241
+ * @template-implements OuterIterator<TKey, TValue>
242
+ *
243
+ * @template-extends IteratorIterator<TKey, TValue>
244
+ */
245
+ class InfiniteIterator extends IteratorIterator implements OuterIterator {
246
+ /**
247
+ * @param Iterator<TKey, TValue> $iterator
248
+ */
249
+ public function __construct(Iterator $iterator) {}
250
+
251
+ /**
252
+ * @return TValue Can return any type.
253
+ */
254
+ public function current() {}
255
+
256
+ /**
257
+ * @return TKey scalar on success, or null on failure.
258
+ */
259
+ public function key() {}
260
+ }
261
+
262
+ /**
263
+ * @template-covariant TKey
264
+ * @template-covariant TValue
265
+ *
266
+ * @template-implements OuterIterator<TKey, TValue>
267
+ *
268
+ * @template-extends IteratorIterator<TKey, TValue>
269
+ */
270
+ class LimitIterator extends IteratorIterator implements OuterIterator {
271
+ /**
272
+ * @param Iterator<TKey, TValue> $iterator
273
+ */
274
+ public function __construct(Iterator $iterator, int $offset = 0, int $count = -1) {}
275
+
276
+ /**
277
+ * @return TValue Can return any type.
278
+ */
279
+ public function current() {}
280
+
281
+ /**
282
+ * @return TKey scalar on success, or null on failure.
283
+ */
284
+ public function key() {}
285
+ }
286
+
287
+ /**
288
+ * @template-covariant TKey
289
+ * @template-covariant TValue
290
+ *
291
+ * @template-implements OuterIterator<TKey, TValue>
292
+ *
293
+ * @template-extends FilterIterator<TKey, TValue>
294
+ */
295
+ class CallbackFilterIterator extends FilterIterator implements OuterIterator {
296
+ /**
297
+ * @param Iterator<TKey, TValue> $iterator
298
+ * @param callable(TValue, TKey, Iterator<TKey, TValue>): bool $callback
299
+ */
300
+ public function __construct(Iterator $iterator, callable $callback) {}
301
+
302
+ /**
303
+ * @return TValue Can return any type.
304
+ */
305
+ public function current() {}
306
+
307
+ /**
308
+ * @return TKey scalar on success, or null on failure.
309
+ */
310
+ public function key() {}
311
+ }
312
+
313
+ /**
314
+ * @template-covariant TKey
315
+ * @template-covariant TValue
316
+ *
317
+ * @template-extends IteratorIterator<TKey, TValue>
318
+ */
319
+ class NoRewindIterator extends IteratorIterator {
320
+ /**
321
+ * @param Iterator<TKey, TValue> $iterator
322
+ */
323
+ public function __construct(Iterator $iterator) {}
324
+
325
+ /**
326
+ * @return TValue Can return any type.
327
+ */
328
+ public function current() {}
329
+
330
+ /**
331
+ * @return TKey scalar on success, or null on failure.
332
+ */
333
+ public function key() {}
334
+ }
335
+
208
336
/**
209
337
* @template-covariant TKey
210
338
* @template-covariant TValue
0 commit comments