-
Notifications
You must be signed in to change notification settings - Fork 4
/
teds_emptycollection.stub.php
354 lines (324 loc) · 9.62 KB
/
teds_emptycollection.stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?php
/**
* @generate-class-entries
* @generate-legacy-arginfo 80000
*/
// Stub generation requires build/gen_stub.php from php 8.1 or newer for enums.
namespace Teds;
#if PHP_VERSION_ID >= 80100
/**
* An EmptySequence is an immutable sequence of length 0.
* NOTE: This is only available in php 8.1+
*/
enum EmptySequence implements \Iterator, Sequence, \JsonSerializable
{
case INSTANCE;
/** @return 0 */
public function count(): int {}
/** @return true */
public function isEmpty(): bool {}
public function toArray(): array {}
/**
* @override
* @implementation-alias Teds\EmptySequence::toArray
*/
public function values(): array {}
/**
* @throws \OutOfBoundsException unconditionally
*/
public function get(int $offset): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
*/
public function set(int $offset, mixed $value): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
*/
public function insert(int $offset, mixed ...$values): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
*/
public function push(mixed ...$values): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
*/
public function pop(): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
* @implementation-alias Teds\EmptySequence::push
*/
public function pushFront(mixed ...$values): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
* @implementation-alias Teds\EmptySequence::pop
*/
public function popFront(): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
* @implementation-alias Teds\EmptySequence::push
*/
public function unshift(mixed ...$values): never {}
/**
* @throws \Teds\UnsupportedOperationException unconditionally
* @implementation-alias Teds\EmptySequence::pop
*/
public function shift(): never {}
/**
* @throws \UnderflowException unconditionally
*/
public function first(): never {}
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function last(): never {}
/**
* Does nothing, does not throw. This is already empty.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function clear(): void {}
// Must be mixed for compatibility with ArrayAccess
/**
* @throws \OutOfBoundsException unconditionally
* @return never
*/
public function offsetGet(mixed $offset): mixed {}
/**
* @return false
*/
public function offsetExists(mixed $offset): bool {}
/**
* @return false
* @implementation-alias Teds\EmptySequence::offsetExists
*/
public function containsKey(mixed $offset): bool {}
/**
* @throws \OutOfBoundsException unconditionally
* @return never
*/
public function offsetSet(mixed $offset, mixed $value): void {}
/**
* @throws \OutOfBoundsException unconditionally
* @return never
*/
public function offsetUnset(mixed $offset): void {}
/**
* @return null
*/
public function indexOf(mixed $value): ?int {}
/**
* @return false
* @implementation-alias Teds\EmptySequence::offsetExists
*/
public function contains(mixed $value): bool {}
/**
* Returns the EmptySequence instance.
*/
public function map(callable $callback): EmptySequence {}
/**
* Returns the EmptySequence instance.
*/
public function filter(?callable $callback = null): EmptySequence {}
/**
* @implementation-alias Teds\EmptySequence::toArray
*/
public function jsonSerialize(): array {}
/** @return false */
public function valid(): bool { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function current(): never { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function key(): never { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function next(): void { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function rewind(): void { }
}
/**
* Immutable empty map.
*/
enum EmptyMap implements \Iterator, Map, \JsonSerializable
{
case INSTANCE;
/**
* Returns the number of elements in the EmptyMap.
* @implementation-alias Teds\EmptySequence::count
*/
public function count(): int {}
/**
* Returns true if there are 0 elements in the EmptyMap.
* @implementation-alias Teds\EmptySequence::isEmpty
*/
public function isEmpty(): bool {}
/**
* Removes all elements from the EmptyMap. (no-op)
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function clear(): void {}
/**
* Returns the empty array
* @implementation-alias Teds\EmptySequence::toArray
*/
public function toArray(): array {}
/**
* Returns the empty array
* @implementation-alias Teds\EmptySequence::toArray
*/
public function values(): array {}
/**
* Returns the empty array
* @implementation-alias Teds\EmptySequence::toArray
*/
public function keys(): array {}
/**
* Returns the value for the given key.
* @throws \OutOfBoundsException if $key is not found and $default was not provided.
*/
public function offsetGet(mixed $key): never {}
/**
* Returns true if the value for the key exists and is not null
* @return false
* @implementation-alias Teds\EmptySequence::contains
*/
public function offsetExists(mixed $key): bool {}
/**
* Sets the value at the given key.
* @implementation-alias Teds\EmptySequence::offsetSet
*/
public function offsetSet(mixed $key, mixed $value): never {}
/**
* No-op for empty map.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function offsetUnset(mixed $key): void {}
/**
* Returns true if there exists a value === $value in this EmptyMap.
* @implementation-alias Teds\EmptySequence::contains
* @return false
*/
public function contains(mixed $value): bool {}
/**
* Returns true if there exists a key === $key in this EmptyMap.
* @implementation-alias Teds\EmptySequence::contains
* @return false
*/
public function containsKey(mixed $key): bool {}
/**
* Returns the value at $key.
* @throws \OutOfBoundsException if $default was not provided.
*/
public function get(mixed $key, mixed $default = null): mixed {}
/**
* @implementation-alias Teds\EmptySequence::toArray
*/
public function jsonSerialize(): array {}
/**
* @return false
* @implementation-alias Teds\EmptySequence::valid
*/
public function valid(): bool { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function current(): never { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function key(): never { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function next(): void { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function rewind(): void { }
}
/**
* Immutable empty set.
*/
enum EmptySet implements \Iterator, Set, \JsonSerializable
{
case INSTANCE;
/**
* Returns the number of elements in the EmptySet
* @implementation-alias Teds\EmptySequence::count
*/
public function count(): int {}
/**
* Returns true if there are 0 elements in the EmptySet.
* @implementation-alias Teds\EmptySequence::isEmpty
*/
public function isEmpty(): bool {}
/**
* Removes all elements from the EmptySet. (no-op)
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function clear(): void {}
/**
* Returns the empty array
* @implementation-alias Teds\EmptySequence::toArray
*/
public function toArray(): array {}
/**
* Returns the empty array
* @implementation-alias Teds\EmptySequence::toArray
*/
public function values(): array {}
/**
* @return false
* @implementation-alias Teds\EmptySequence::offsetExists
*/
public function contains(mixed $value): bool {}
/**
* Returns true if $value was added to this EmptySet and was not previously in this EmptySet.
* @implementation-alias Teds\EmptySequence::offsetUnset
*/
public function add(mixed $value): never {}
/**
* Returns true if $value was found in this EmptySet before being removed from this EmptySet.
* @return false
* @implementation-alias Teds\EmptySequence::contains
*/
public function remove(mixed $value): bool {}
/**
* Returns [v1, v2, ...]
* @implementation-alias Teds\EmptySequence::toArray
*/
public function jsonSerialize(): array {}
/**
* @return false
* @implementation-alias Teds\EmptySequence::valid
*/
public function valid(): bool { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function current(): never { }
/**
* @implementation-alias Teds\EmptySequence::first
*/
public function key(): never { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function next(): void { }
/**
* Does nothing.
* @implementation-alias Teds\StrictMinHeap::rewind
*/
public function rewind(): void { }
}
#endif