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