xref: /php-src/Zend/zend_interfaces.stub.php (revision 322864b5)
1<?php
2
3/** @generate-class-entries */
4
5interface Traversable {}
6
7interface IteratorAggregate extends Traversable
8{
9    /** @tentative-return-type */
10    public function getIterator(): Traversable;
11}
12
13interface Iterator extends Traversable
14{
15    /** @tentative-return-type */
16    public function current(): mixed;
17
18    /** @tentative-return-type */
19    public function next(): void;
20
21    /** @tentative-return-type */
22    public function key(): mixed;
23
24    /** @tentative-return-type */
25    public function valid(): bool;
26
27    /** @tentative-return-type */
28    public function rewind(): void;
29}
30
31interface ArrayAccess
32{
33    /** @tentative-return-type */
34    public function offsetExists(mixed $offset): bool;
35
36    /**
37     * Actually this should be return by ref but atm cannot be.
38     * @tentative-return-type
39     */
40    public function offsetGet(mixed $offset): mixed;
41
42    /** @tentative-return-type */
43    public function offsetSet(mixed $offset, mixed $value): void;
44
45    /** @tentative-return-type */
46    public function offsetUnset(mixed $offset): void;
47}
48
49interface Serializable
50{
51    /** @return string|null */
52    public function serialize();
53
54    /** @return void */
55    public function unserialize(string $data);
56}
57
58interface Countable
59{
60    /** @tentative-return-type */
61    public function count(): int;
62}
63
64interface Stringable
65{
66    public function __toString(): string;
67}
68
69/**
70 * @not-serializable
71 */
72final class InternalIterator implements Iterator
73{
74    private function __construct() {}
75
76    public function current(): mixed {}
77
78    public function key(): mixed {}
79
80    public function next(): void {}
81
82    public function valid(): bool {}
83
84    public function rewind(): void {}
85}
86