Skip to content

Commit 0192fd2

Browse files
committed
Merge branch 'PHP-8.0'
2 parents aa733e8 + 80e5ad5 commit 0192fd2

File tree

7 files changed

+49
-53
lines changed

7 files changed

+49
-53
lines changed

build/gen_stub.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public static function fromNode(Node $node): SimpleType {
125125
return new SimpleType($node->toString(), true);
126126
}
127127

128+
if ($node->toLowerString() === 'self') {
129+
throw new Exception('The exact class name must be used instead of "self"');
130+
}
131+
128132
assert($node->isFullyQualified());
129133
return new SimpleType($node->toString(), false);
130134
}
@@ -149,9 +153,10 @@ public static function fromPhpDoc(string $type): SimpleType
149153
case "object":
150154
case "resource":
151155
case "mixed":
152-
case "self":
153156
case "static":
154157
return new SimpleType(strtolower($type), true);
158+
case "self":
159+
throw new Exception('The exact class name must be used instead of "self"');
155160
}
156161

157162
if (strpos($type, "[]") !== false) {
@@ -1510,6 +1515,10 @@ function parseFunctionLike(
15101515
}
15111516
}
15121517

1518+
if ($param->default instanceof Expr\ClassConstFetch && $param->default->class->toLowerString() === "self") {
1519+
throw new Exception('The exact class name must be used instead of "self"');
1520+
}
1521+
15131522
$foundVariadic = $param->variadic;
15141523

15151524
$args[] = new ArgInfo(

ext/spl/spl_array.stub.php

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,17 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count
66
{
77
public function __construct(array|object $array = [], int $flags = 0, string $iteratorClass = ArrayIterator::class) {}
88

9-
/**
10-
* @param string|int $key
11-
* @return bool
12-
*/
13-
public function offsetExists($key) {}
9+
/** @return bool */
10+
public function offsetExists(mixed $key) {}
1411

15-
/**
16-
* @param string|int $key
17-
* @return mixed
18-
*/
19-
public function offsetGet($key) {}
12+
/** @return mixed */
13+
public function offsetGet(mixed $key) {}
2014

21-
/**
22-
* @param string|int $key
23-
* @return void
24-
*/
25-
public function offsetSet($key, mixed $value) {}
15+
/** @return void */
16+
public function offsetSet(mixed $key, mixed $value) {}
2617

27-
/**
28-
* @param string|int $key
29-
* @return void
30-
*/
31-
public function offsetUnset($key) {}
18+
/** @return void */
19+
public function offsetUnset(mixed $key) {}
3220

3321
/** @return void */
3422
public function append(mixed $value) {}
@@ -96,32 +84,28 @@ class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Coun
9684
public function __construct(array|object $array = [], int $flags = 0) {}
9785

9886
/**
99-
* @param string|int $key
10087
* @return bool
10188
* @implementation-alias ArrayObject::offsetExists
10289
*/
103-
public function offsetExists($key) {}
90+
public function offsetExists(mixed $key) {}
10491

10592
/**
106-
* @param string|int $key
10793
* @return mixed
10894
* @implementation-alias ArrayObject::offsetGet
10995
*/
110-
public function offsetGet($key) {}
96+
public function offsetGet(mixed $key) {}
11197

11298
/**
113-
* @param string|int $key
11499
* @return void
115100
* @implementation-alias ArrayObject::offsetSet
116101
*/
117-
public function offsetSet($key, mixed $value) {}
102+
public function offsetSet(mixed $key, mixed $value) {}
118103

119104
/**
120-
* @param string|int $key
121105
* @return void
122106
* @implementation-alias ArrayObject::offsetUnset
123107
*/
124-
public function offsetUnset($key) {}
108+
public function offsetUnset(mixed $key) {}
125109

126110
/**
127111
* @return void

ext/spl/spl_array_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: e1f39b5dcb4da47427d5a1a13c9949c8b0a7ba8b */
2+
* Stub hash: 309be43f56774d35e7bddd4bf7f119e0d4c99d12 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_MASK(0, array, MAY_BE_ARRAY|MAY_BE_OBJECT, "[]")
@@ -8,13 +8,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject___construct, 0, 0, 0)
88
ZEND_END_ARG_INFO()
99

1010
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject_offsetExists, 0, 0, 1)
11-
ZEND_ARG_INFO(0, key)
11+
ZEND_ARG_TYPE_INFO(0, key, IS_MIXED, 0)
1212
ZEND_END_ARG_INFO()
1313

1414
#define arginfo_class_ArrayObject_offsetGet arginfo_class_ArrayObject_offsetExists
1515

1616
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayObject_offsetSet, 0, 0, 2)
17-
ZEND_ARG_INFO(0, key)
17+
ZEND_ARG_TYPE_INFO(0, key, IS_MIXED, 0)
1818
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
1919
ZEND_END_ARG_INFO()
2020

ext/spl/spl_directory.stub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function rewind() {}
148148
/** @return string */
149149
public function key() {}
150150

151-
/** @return string|SplFileInfo|self */
151+
/** @return string|SplFileInfo|FilesystemIterator */
152152
public function current() {}
153153

154154
/** @return int */
@@ -211,7 +211,7 @@ public function fgetcsv(string $separator = ",", string $enclosure = "\"", strin
211211
/** @return int|false */
212212
public function fputcsv(array $fields, string $separator = ",", string $enclosure = "\"", string $escape = "\\", string $eol = "\n") {}
213213

214-
/** @return bool|null */
214+
/** @return void */
215215
public function setCsvControl(string $separator = ",", string $enclosure = "\"", string $escape = "\\") {}
216216

217217
/** @return array */
@@ -238,7 +238,7 @@ public function fgetc() {}
238238
/** @return int */
239239
public function fpassthru() {}
240240

241-
/** @return array|int|false|null */
241+
/** @return array|int|null */
242242
public function fscanf(string $format, mixed &...$vars) {}
243243

244244
/** @return int|false */
@@ -274,7 +274,7 @@ public function getMaxLineLen() {}
274274
/** @return bool */
275275
public function hasChildren() {}
276276

277-
/** @return null */
277+
/** @return RecursiveIterator|null */
278278
public function getChildren() {}
279279

280280
/** @return void */

ext/spl/spl_directory_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: bea6fbfdd7ff20de998dcd24bef4fd2ab56d5041 */
2+
* Stub hash: 7d34368a9fcdde100433b57fe2ef88bb4334e403 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)

ext/spl/spl_iterators.stub.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ interface RecursiveIterator extends Iterator
4747
/** @return bool */
4848
public function hasChildren();
4949

50-
/** @return RecursiveIterator */
50+
/** @return RecursiveIterator|null */
5151
public function getChildren();
5252
}
5353

5454
class RecursiveIteratorIterator implements OuterIterator
5555
{
56-
public function __construct(Traversable $iterator, int $mode = self::LEAVES_ONLY, int $flags = 0) {}
56+
public function __construct(Traversable $iterator, int $mode = RecursiveIteratorIterator::LEAVES_ONLY, int $flags = 0) {}
5757

5858
/** @return void */
5959
public function rewind() {}
@@ -200,7 +200,7 @@ public function getPosition() {}
200200

201201
class CachingIterator extends IteratorIterator implements ArrayAccess, Countable, Stringable
202202
{
203-
public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {}
203+
public function __construct(Iterator $iterator, int $flags = CachingIterator::CALL_TOSTRING) {}
204204

205205
/** @return void */
206206
public function rewind() {}
@@ -255,7 +255,7 @@ public function count() {}
255255

256256
class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator
257257
{
258-
public function __construct(Iterator $iterator, int $flags = self::CALL_TOSTRING) {}
258+
public function __construct(Iterator $iterator, int $flags = RecursiveCachingIterator::CALL_TOSTRING) {}
259259

260260
/** @return bool */
261261
public function hasChildren() {}
@@ -322,7 +322,7 @@ class RegexIterator extends FilterIterator
322322
{
323323
public ?string $replacement = null;
324324

325-
public function __construct(Iterator $iterator, string $pattern, int $mode = self::MATCH, int $flags = 0, int $pregFlags = 0) {}
325+
public function __construct(Iterator $iterator, string $pattern, int $mode = RegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
326326

327327
/** @return bool */
328328
public function accept() {}
@@ -351,7 +351,7 @@ public function setPregFlags(int $pregFlags) {}
351351

352352
class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
353353
{
354-
public function __construct(RecursiveIterator $iterator, string $pattern, int $mode = self::MATCH, int $flags = 0, int $pregFlags = 0) {}
354+
public function __construct(RecursiveIterator $iterator, string $pattern, int $mode = RecursiveRegexIterator::MATCH, int $flags = 0, int $pregFlags = 0) {}
355355

356356
/** @return bool */
357357
public function accept() {}
@@ -371,9 +371,9 @@ class RecursiveTreeIterator extends RecursiveIteratorIterator
371371
/** @param RecursiveIterator|IteratorAggregate $iterator */
372372
public function __construct(
373373
$iterator,
374-
int $flags = self::BYPASS_KEY,
374+
int $flags = RecursiveTreeIterator::BYPASS_KEY,
375375
int $cachingIteratorFlags = CachingIterator::CATCH_GET_CHILD,
376-
int $mode = self::SELF_FIRST
376+
int $mode = RecursiveTreeIterator::SELF_FIRST
377377
) {}
378378

379379
/** @return mixed */

ext/spl/spl_iterators_arginfo.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: faf45a8d4e731dccfc161514f233a78d98b716e9 */
2+
* Stub hash: de49628718b5fff1a3b2516cc89108e01b67c312 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0)
55
ZEND_END_ARG_INFO()
@@ -34,7 +34,7 @@ ZEND_END_ARG_INFO()
3434

3535
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveIteratorIterator___construct, 0, 0, 1)
3636
ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
37-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::LEAVES_ONLY")
37+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveIteratorIterator::LEAVES_ONLY")
3838
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
3939
ZEND_END_ARG_INFO()
4040

@@ -139,7 +139,7 @@ ZEND_END_ARG_INFO()
139139

140140
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CachingIterator___construct, 0, 0, 1)
141141
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
142-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "self::CALL_TOSTRING")
142+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "CachingIterator::CALL_TOSTRING")
143143
ZEND_END_ARG_INFO()
144144

145145
#define arginfo_class_CachingIterator_rewind arginfo_class_EmptyIterator_current
@@ -176,7 +176,10 @@ ZEND_END_ARG_INFO()
176176

177177
#define arginfo_class_CachingIterator_count arginfo_class_EmptyIterator_current
178178

179-
#define arginfo_class_RecursiveCachingIterator___construct arginfo_class_CachingIterator___construct
179+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveCachingIterator___construct, 0, 0, 1)
180+
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
181+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "RecursiveCachingIterator::CALL_TOSTRING")
182+
ZEND_END_ARG_INFO()
180183

181184
#define arginfo_class_RecursiveCachingIterator_hasChildren arginfo_class_EmptyIterator_current
182185

@@ -217,7 +220,7 @@ ZEND_END_ARG_INFO()
217220
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RegexIterator___construct, 0, 0, 2)
218221
ZEND_ARG_OBJ_INFO(0, iterator, Iterator, 0)
219222
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
220-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::MATCH")
223+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RegexIterator::MATCH")
221224
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
222225
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pregFlags, IS_LONG, 0, "0")
223226
ZEND_END_ARG_INFO()
@@ -245,7 +248,7 @@ ZEND_END_ARG_INFO()
245248
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveRegexIterator___construct, 0, 0, 2)
246249
ZEND_ARG_OBJ_INFO(0, iterator, RecursiveIterator, 0)
247250
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
248-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::MATCH")
251+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveRegexIterator::MATCH")
249252
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
250253
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pregFlags, IS_LONG, 0, "0")
251254
ZEND_END_ARG_INFO()
@@ -258,9 +261,9 @@ ZEND_END_ARG_INFO()
258261

259262
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveTreeIterator___construct, 0, 0, 1)
260263
ZEND_ARG_INFO(0, iterator)
261-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "self::BYPASS_KEY")
264+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "RecursiveTreeIterator::BYPASS_KEY")
262265
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cachingIteratorFlags, IS_LONG, 0, "CachingIterator::CATCH_GET_CHILD")
263-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "self::SELF_FIRST")
266+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "RecursiveTreeIterator::SELF_FIRST")
264267
ZEND_END_ARG_INFO()
265268

266269
#define arginfo_class_RecursiveTreeIterator_key arginfo_class_EmptyIterator_current

0 commit comments

Comments
 (0)