-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathteds_vector.stub.php
156 lines (140 loc) · 5.38 KB
/
teds_vector.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
<?php
/**
* @generate-class-entries
* @generate-legacy-arginfo 80000
*/
namespace Teds;
/**
* A Vector is a container of a sequence of values (with keys 0, 1, ...count($vector) - 1)
* that can change in size.
*
* This is backed by a memory-efficient representation
* (raw array of values) and provides fast access (compared to other objects in the Spl)
* and constant amortized-time push/pop operations.
*
* Attempting to read or write values outside of the range of values with `*get`/`*set` methods will throw at runtime.
*/
final class Vector implements \IteratorAggregate, Sequence, \JsonSerializable
{
/**
* Construct a Vector from an iterable.
*
* The keys will be ignored, and values will be reindexed without gaps starting from 0
*/
public function __construct(iterable $iterator = []) {}
/**
* Returns an iterator that will return the indexes and values of iterable until index >= count()
*/
public function getIterator(): \InternalIterator {}
/**
* Returns the number of values in this Vector
*/
public function count(): int {}
/**
* Returns whether this vector is empty (has a count of 0)
*/
public function isEmpty(): bool {}
/**
* Returns the total capacity of this Vector.
*/
public function capacity(): int {}
/**
* Reduces the Vector's capacity to its size, freeing any extra unused memory.
*/
public function shrinkToFit(): void {}
/**
* If the current capacity is less than $capacity, raise it to capacity.
* @throws \UnexpectedValueException if the new capacity is too large
*/
public function reserve(int $capacity): void {}
/**
* Remove all elements from the array and free all reserved capacity.
*/
public function clear(): void {}
/**
* If $size is greater than the current size, raise the size and fill the free space with $value
* If $size is less than the current size, reduce the size and discard elements.
*/
public function setSize(int $size, mixed $value = null): void {}
/**
* @implementation-alias Teds\Vector::toArray
*/
public function __serialize(): array {}
public function __unserialize(array $data): void {}
public static function __set_state(array $array): Vector {}
public function push(mixed ...$values): void {}
public function pop(): mixed {}
public function pushFront(mixed ...$values): void {}
public function popFront(): mixed {}
/** @implementation-alias Teds\Vector::pushFront */
public function unshift(mixed ...$values): void {}
/** @implementation-alias Teds\Vector::popFront */
public function shift(): mixed {}
/** Read the first value or throws \UnderflowException */
public function first(): mixed {}
/** Read the last value or throws \UnderflowException */
public function last(): mixed {}
public function toArray(): array {}
/**
* @implementation-alias Teds\Vector::toArray
* @override for Sequence::values()
*/
public function values(): array {}
// Strictly typed, unlike offsetGet/offsetSet
public function get(int $offset): mixed {}
public function set(int $offset, mixed $value): void {}
public function insert(int $offset, mixed ...$values): void {}
/**
* Returns the value at (int)$offset.
* @throws \OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
*/
public function offsetGet(mixed $offset): mixed {}
/**
* Returns true if `0 <= (int)$offset && (int)$offset < $this->count()
* AND the value of offsetGet is non-null.
*/
public function offsetExists(mixed $offset): bool {}
/**
* Returns true if `is_int($offset) && 0 <= $offset && $offset < $this->count()
*/
public function containsKey(mixed $offset): bool {}
/**
* Sets the value at offset (int)$offset to $value
* @throws \OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
*/
public function offsetSet(mixed $offset, mixed $value): void {}
/**
* Removes the element at (int)$offset and reindexes the following elements of the vector.
* @throws \OutOfBoundsException if the value of (int)$offset is not within the bounds of this vector
*/
public function offsetUnset(mixed $offset): void {}
/**
* Returns the offset of a value that is === $value, or returns null.
*/
public function indexOf(mixed $value): ?int {}
/**
* Returns true if there exists a value === $value in this vector.
*/
public function contains(mixed $value): bool {}
/**
* Returns a new Vector instance created from the return values of $callable($element)
* being applied to each element of this vector.
*
* (at)param null|callable(mixed):mixed $callback
*/
public function map(callable $callback): Vector {}
/**
* Returns the subset of elements of the Vector satisfying the predicate.
*
* If the value returned by the callback is truthy
* (e.g. true, non-zero number, non-empty array, truthy object, etc.),
* this is treated as satisfying the predicate.
*
* (at)param null|callable(mixed):bool $callback
*/
public function filter(?callable $callback = null): Vector {}
/**
* @implementation-alias Teds\Vector::toArray
*/
public function jsonSerialize(): array {}
}