xref: /PHP-8.2/ext/spl/tests/iterator_009.phpt (revision 8dbfb15f)
1--TEST--
2SPL: EmptyIterator
3--FILE--
4<?php
5
6class EmptyIteratorEx extends EmptyIterator
7{
8    function rewind(): void
9    {
10        echo __METHOD__ . "\n";
11        parent::rewind();
12    }
13    function valid(): false
14    {
15        echo __METHOD__ . "\n";
16        return parent::valid();
17    }
18    function current(): never
19    {
20        echo __METHOD__ . "\n";
21        parent::current();
22    }
23    function key(): never
24    {
25        echo __METHOD__ . "\n";
26        parent::key();
27    }
28    function next(): void
29    {
30        echo __METHOD__ . "\n";
31        parent::next();
32    }
33}
34
35foreach (new EmptyIteratorEx() as $v) {
36    var_dump($v);
37}
38
39?>
40--EXPECT--
41EmptyIteratorEx::rewind
42EmptyIteratorEx::valid
43