xref: /PHP-8.1/ext/spl/spl_array.stub.php (revision f556a30b)
1<?php
2
3/** @generate-class-entries */
4
5class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable
6{
7    public function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class) {}
8
9    /** @tentative-return-type */
10    public function offsetExists(mixed $key): bool {}
11
12    /** @tentative-return-type */
13    public function offsetGet(mixed $key): mixed {}
14
15    /** @tentative-return-type */
16    public function offsetSet(mixed $key, mixed $value): void {}
17
18    /** @tentative-return-type */
19    public function offsetUnset(mixed $key): void {}
20
21    /** @tentative-return-type */
22    public function append(mixed $value): void {}
23
24    /** @tentative-return-type */
25    public function getArrayCopy(): array {}
26
27    /** @tentative-return-type */
28    public function count(): int {}
29
30    /** @tentative-return-type */
31    public function getFlags(): int {}
32
33    /** @tentative-return-type */
34    public function setFlags(int $flags): void {}
35
36    /** @tentative-return-type */
37    public function asort(int $flags = SORT_REGULAR): bool {}
38
39    /** @tentative-return-type */
40    public function ksort(int $flags = SORT_REGULAR): bool {}
41
42    /** @tentative-return-type */
43    public function uasort(callable $callback): bool {}
44
45    /** @tentative-return-type */
46    public function uksort(callable $callback): bool {}
47
48    /** @tentative-return-type */
49    public function natsort(): bool {}
50
51    /** @tentative-return-type */
52    public function natcasesort(): bool {}
53
54    /** @tentative-return-type */
55    public function unserialize(string $data): void {}
56
57    /** @tentative-return-type */
58    public function serialize(): string {}
59
60    /** @tentative-return-type */
61    public function __serialize(): array {}
62
63    /** @tentative-return-type */
64    public function __unserialize(array $data): void {}
65
66    /** @tentative-return-type */
67    public function getIterator(): Iterator {}
68
69    /** @tentative-return-type */
70    public function exchangeArray(array|object $array): array {}
71
72    /** @tentative-return-type */
73    public function setIteratorClass(string $iteratorClass): void {}
74
75    /** @tentative-return-type */
76    public function getIteratorClass(): string {}
77
78    /** @tentative-return-type */
79    public function __debugInfo(): array {}
80}
81
82class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable
83{
84    public function __construct(array|object $array = [], int $flags = 0) {}
85
86    /**
87     * @tentative-return-type
88     * @implementation-alias ArrayObject::offsetExists
89     */
90    public function offsetExists(mixed $key): bool {}
91
92    /**
93     * @tentative-return-type
94     * @implementation-alias ArrayObject::offsetGet
95     */
96    public function offsetGet(mixed $key): mixed {}
97
98    /**
99     * @tentative-return-type
100     * @implementation-alias ArrayObject::offsetSet
101     */
102    public function offsetSet(mixed $key, mixed $value): void {}
103
104    /**
105     * @tentative-return-type
106     * @implementation-alias ArrayObject::offsetUnset
107     */
108    public function offsetUnset(mixed $key): void {}
109
110    /**
111     * @tentative-return-type
112     * @implementation-alias ArrayObject::append
113     */
114    public function append(mixed $value): void {}
115
116    /**
117     * @tentative-return-type
118     * @implementation-alias ArrayObject::getArrayCopy
119     */
120    public function getArrayCopy(): array {}
121
122    /**
123     * @tentative-return-type
124     * @implementation-alias ArrayObject::count
125     */
126    public function count(): int {}
127
128    /**
129     * @tentative-return-type
130     * @implementation-alias ArrayObject::getFlags
131     */
132    public function getFlags(): int {}
133
134    /**
135     * @tentative-return-type
136     * @implementation-alias ArrayObject::setFlags
137     */
138    public function setFlags(int $flags): void {}
139
140    /**
141     * @tentative-return-type
142     * @implementation-alias ArrayObject::asort
143     */
144    public function asort(int $flags = SORT_REGULAR): bool {}
145
146    /**
147     * @tentative-return-type
148     * @implementation-alias ArrayObject::ksort
149     */
150    public function ksort(int $flags = SORT_REGULAR): bool {}
151
152    /**
153     * @tentative-return-type
154     * @implementation-alias ArrayObject::uasort
155     */
156    public function uasort(callable $callback): bool {}
157
158    /**
159     * @tentative-return-type
160     * @implementation-alias ArrayObject::uksort
161     */
162    public function uksort(callable $callback): bool {}
163
164    /**
165     * @tentative-return-type
166     * @implementation-alias ArrayObject::natsort
167     */
168    public function natsort(): bool {}
169
170    /**
171     * @tentative-return-type
172     * @implementation-alias ArrayObject::natcasesort
173     */
174    public function natcasesort(): bool {}
175
176    /**
177     * @tentative-return-type
178     * @implementation-alias ArrayObject::unserialize
179     */
180    public function unserialize(string $data): void {}
181
182    /**
183     * @tentative-return-type
184     * @implementation-alias ArrayObject::serialize
185     */
186    public function serialize(): string {}
187
188    /**
189     * @tentative-return-type
190     * @implementation-alias ArrayObject::__serialize
191     */
192    public function __serialize(): array {}
193
194    /**
195     * @tentative-return-type
196     * @implementation-alias ArrayObject::__unserialize
197     */
198    public function __unserialize(array $data): void {}
199
200    /** @tentative-return-type */
201    public function rewind(): void {}
202
203    /** @tentative-return-type */
204    public function current(): mixed {}
205
206    /** @tentative-return-type */
207    public function key(): string|int|null {}
208
209    /** @tentative-return-type */
210    public function next(): void {}
211
212    /** @tentative-return-type */
213    public function valid(): bool {}
214
215    /** @tentative-return-type */
216    public function seek(int $offset): void {}
217
218    /**
219     * @tentative-return-type
220     * @implementation-alias ArrayObject::__debugInfo
221     */
222    public function __debugInfo(): array {}
223}
224
225class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
226{
227    /** @tentative-return-type */
228    public function hasChildren(): bool {}
229
230    /** @tentative-return-type */
231    public function getChildren(): ?RecursiveArrayIterator {}
232}
233