Skip to content

Commit ae72004

Browse files
committed
Declare tentative return types for ext/spl - part 1
1 parent b8e380a commit ae72004

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+554
-552
lines changed

ext/spl/spl_array.stub.php

Lines changed: 104 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -8,87 +8,87 @@ public function __construct(array|object $array = [], int $flags = 0, string $it
88

99
/**
1010
* @param string|int $key
11-
* @return bool
11+
* @tentative-return-type
1212
*/
13-
public function offsetExists($key) {}
13+
public function offsetExists($key): bool {}
1414

1515
/**
1616
* @param string|int $key
17-
* @return mixed
17+
* @tentative-return-type
1818
*/
19-
public function offsetGet($key) {}
19+
public function offsetGet($key): mixed {}
2020

2121
/**
2222
* @param string|int $key
23-
* @return void
23+
* @tentative-return-type
2424
*/
25-
public function offsetSet($key, mixed $value) {}
25+
public function offsetSet($key, mixed $value): void {}
2626

2727
/**
2828
* @param string|int $key
29-
* @return void
29+
* @tentative-return-type
3030
*/
31-
public function offsetUnset($key) {}
31+
public function offsetUnset($key): void {}
3232

33-
/** @return void */
34-
public function append(mixed $value) {}
33+
/** @tentative-return-type */
34+
public function append(mixed $value): void {}
3535

36-
/** @return array */
37-
public function getArrayCopy() {}
36+
/** @tentative-return-type */
37+
public function getArrayCopy(): array {}
3838

39-
/** @return int */
40-
public function count() {}
39+
/** @tentative-return-type */
40+
public function count(): int {}
4141

42-
/** @return int */
43-
public function getFlags() {}
42+
/** @tentative-return-type */
43+
public function getFlags(): int {}
4444

45-
/** @return void */
46-
public function setFlags(int $flags) {}
45+
/** @tentative-return-type */
46+
public function setFlags(int $flags): void {}
4747

48-
/** @return bool */
49-
public function asort(int $flags = SORT_REGULAR) {}
48+
/** @tentative-return-type */
49+
public function asort(int $flags = SORT_REGULAR): bool {}
5050

51-
/** @return bool */
52-
public function ksort(int $flags = SORT_REGULAR) {}
51+
/** @tentative-return-type */
52+
public function ksort(int $flags = SORT_REGULAR): bool {}
5353

54-
/** @return bool */
55-
public function uasort(callable $callback) {}
54+
/** @tentative-return-type */
55+
public function uasort(callable $callback): bool {}
5656

57-
/** @return bool */
58-
public function uksort(callable $callback) {}
57+
/** @tentative-return-type */
58+
public function uksort(callable $callback): bool {}
5959

60-
/** @return bool */
61-
public function natsort() {}
60+
/** @tentative-return-type */
61+
public function natsort(): bool {}
6262

63-
/** @return bool */
64-
public function natcasesort() {}
63+
/** @tentative-return-type */
64+
public function natcasesort(): bool {}
6565

66-
/** @return void */
67-
public function unserialize(string $data) {}
66+
/** @tentative-return-type */
67+
public function unserialize(string $data): void {}
6868

69-
/** @return string */
70-
public function serialize() {}
69+
/** @tentative-return-type */
70+
public function serialize(): string {}
7171

72-
/** @return array */
73-
public function __serialize() {}
72+
/** @tentative-return-type */
73+
public function __serialize(): array {}
7474

75-
/** @return void */
76-
public function __unserialize(array $data) {}
75+
/** @tentative-return-type */
76+
public function __unserialize(array $data): void {}
7777

78-
/** @return Iterator */
79-
public function getIterator() {}
78+
/** @tentative-return-type */
79+
public function getIterator(): Iterator {}
8080

81-
/** @return array|null */
82-
public function exchangeArray(array|object $array) {}
81+
/** @tentative-return-type */
82+
public function exchangeArray(array|object $array): ?array {}
8383

84-
/** @return void */
85-
public function setIteratorClass(string $iteratorClass) {}
84+
/** @tentative-return-type */
85+
public function setIteratorClass(string $iteratorClass): void {}
8686

87-
/** @return string */
88-
public function getIteratorClass() {}
87+
/** @tentative-return-type */
88+
public function getIteratorClass(): string {}
8989

90-
/** @return array */
91-
public function __debugInfo() {}
90+
/** @tentative-return-type */
91+
public function __debugInfo(): array {}
9292
}
9393

9494
class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable
@@ -97,152 +97,152 @@ public function __construct(array|object $array = [], int $flags = 0) {}
9797

9898
/**
9999
* @param string|int $key
100-
* @return bool
100+
* @tentative-return-type
101101
* @implementation-alias ArrayObject::offsetExists
102102
*/
103-
public function offsetExists($key) {}
103+
public function offsetExists($key): bool {}
104104

105105
/**
106106
* @param string|int $key
107-
* @return mixed
107+
* @tentative-return-type
108108
* @implementation-alias ArrayObject::offsetGet
109109
*/
110-
public function offsetGet($key) {}
110+
public function offsetGet($key): mixed {}
111111

112112
/**
113113
* @param string|int $key
114-
* @return void
114+
* @tentative-return-type
115115
* @implementation-alias ArrayObject::offsetSet
116116
*/
117-
public function offsetSet($key, mixed $value) {}
117+
public function offsetSet($key, mixed $value): void {}
118118

119119
/**
120120
* @param string|int $key
121-
* @return void
121+
* @tentative-return-type
122122
* @implementation-alias ArrayObject::offsetUnset
123123
*/
124-
public function offsetUnset($key) {}
124+
public function offsetUnset($key): void {}
125125

126126
/**
127-
* @return void
127+
* @tentative-return-type
128128
* @implementation-alias ArrayObject::append
129129
*/
130-
public function append(mixed $value) {}
130+
public function append(mixed $value): void {}
131131

132132
/**
133-
* @return array
133+
* @tentative-return-type
134134
* @implementation-alias ArrayObject::getArrayCopy
135135
*/
136-
public function getArrayCopy() {}
136+
public function getArrayCopy(): array {}
137137

138138
/**
139-
* @return int
139+
* @tentative-return-type
140140
* @implementation-alias ArrayObject::count
141141
*/
142-
public function count() {}
142+
public function count(): int {}
143143

144144
/**
145-
* @return int
145+
* @tentative-return-type
146146
* @implementation-alias ArrayObject::getFlags
147147
*/
148-
public function getFlags() {}
148+
public function getFlags(): int {}
149149

150150
/**
151-
* @return void
151+
* @tentative-return-type
152152
* @implementation-alias ArrayObject::setFlags
153153
*/
154-
public function setFlags(int $flags) {}
154+
public function setFlags(int $flags): void {}
155155

156156
/**
157-
* @return bool
157+
* @tentative-return-type
158158
* @implementation-alias ArrayObject::asort
159159
*/
160-
public function asort(int $flags = SORT_REGULAR) {}
160+
public function asort(int $flags = SORT_REGULAR): bool {}
161161

162162
/**
163-
* @return bool
163+
* @tentative-return-type
164164
* @implementation-alias ArrayObject::ksort
165165
*/
166-
public function ksort(int $flags = SORT_REGULAR) {}
166+
public function ksort(int $flags = SORT_REGULAR): bool {}
167167

168168
/**
169-
* @return bool
169+
* @tentative-return-type
170170
* @implementation-alias ArrayObject::uasort
171171
*/
172-
public function uasort(callable $callback) {}
172+
public function uasort(callable $callback): bool {}
173173

174174
/**
175-
* @return bool
175+
* @tentative-return-type
176176
* @implementation-alias ArrayObject::uksort
177177
*/
178-
public function uksort(callable $callback) {}
178+
public function uksort(callable $callback): bool {}
179179

180180
/**
181-
* @return bool
181+
* @tentative-return-type
182182
* @implementation-alias ArrayObject::natsort
183183
*/
184-
public function natsort() {}
184+
public function natsort(): bool {}
185185

186186
/**
187-
* @return bool
187+
* @tentative-return-type
188188
* @implementation-alias ArrayObject::natcasesort
189189
*/
190-
public function natcasesort() {}
190+
public function natcasesort(): bool {}
191191

192192
/**
193-
* @return void
193+
* @tentative-return-type
194194
* @implementation-alias ArrayObject::unserialize
195195
*/
196-
public function unserialize(string $data) {}
196+
public function unserialize(string $data): void {}
197197

198198
/**
199-
* @return string
199+
* @tentative-return-type
200200
* @implementation-alias ArrayObject::serialize
201201
*/
202-
public function serialize() {}
202+
public function serialize(): string {}
203203

204204
/**
205-
* @return array
205+
* @tentative-return-type
206206
* @implementation-alias ArrayObject::__serialize
207207
*/
208-
public function __serialize() {}
208+
public function __serialize(): array {}
209209

210210
/**
211-
* @return void
211+
* @tentative-return-type
212212
* @implementation-alias ArrayObject::__unserialize
213213
*/
214-
public function __unserialize(array $data) {}
214+
public function __unserialize(array $data): void {}
215215

216-
/** @return void */
217-
public function rewind() {}
216+
/** @tentative-return-type */
217+
public function rewind(): void {}
218218

219-
/** @return mixed */
220-
public function current() {}
219+
/** @tentative-return-type */
220+
public function current(): mixed {}
221221

222-
/** @return mixed */
223-
public function key() {}
222+
/** @tentative-return-type */
223+
public function key(): mixed {}
224224

225-
/** @return void */
226-
public function next() {}
225+
/** @tentative-return-type */
226+
public function next(): void {}
227227

228-
/** @return bool */
229-
public function valid() {}
228+
/** @tentative-return-type */
229+
public function valid(): bool {}
230230

231-
/** @return void */
232-
public function seek(int $offset) {}
231+
/** @tentative-return-type */
232+
public function seek(int $offset): void {}
233233

234234
/**
235-
* @return array
235+
* @tentative-return-type
236236
* @implementation-alias ArrayObject::__debugInfo
237237
*/
238-
public function __debugInfo() {}
238+
public function __debugInfo(): array {}
239239
}
240240

241241
class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
242242
{
243-
/** @return bool */
244-
public function hasChildren() {}
243+
/** @tentative-return-type */
244+
public function hasChildren(): bool {}
245245

246-
/** @return RecursiveArrayIterator|null */
247-
public function getChildren() {}
246+
/** @tentative-return-type */
247+
public function getChildren(): ?RecursiveArrayIterator {}
248248
}

0 commit comments

Comments
 (0)