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