Skip to content

Commit 70b3b1b

Browse files
committed
Review fixes
1 parent bfca7a9 commit 70b3b1b

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

build/gen_stub.php

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

121+
if ($node->toLowerString() === 'self') {
122+
throw new Exception('The exact class name must be used instead of "self"');
123+
}
124+
121125
assert($node->isFullyQualified());
122126
return new SimpleType($node->toString(), false);
123127
}
@@ -142,9 +146,10 @@ public static function fromPhpDoc(string $type): SimpleType
142146
case "object":
143147
case "resource":
144148
case "mixed":
145-
case "self":
146149
case "static":
147150
return new SimpleType(strtolower($type), true);
151+
case "self":
152+
throw new Exception('The exact class name must be used instead of "self"');
148153
}
149154

150155
if (strpos($type, "[]") !== false) {
@@ -1162,6 +1167,10 @@ function parseFunctionLike(
11621167
}
11631168
}
11641169

1170+
if ($param->default instanceof Expr\ClassConstFetch && $param->default->class->toLowerString() === "self") {
1171+
throw new Exception('The exact class name must be used instead of "self"');
1172+
}
1173+
11651174
$foundVariadic = $param->variadic;
11661175

11671176
$args[] = new ArgInfo(

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: da85db1e5e985ddbefaf38598133e3cba46475f2 */
2+
* Stub hash: d54484f7b381c690b69bd1fb26450563b348ae7a */
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: 3 additions & 3 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 */
@@ -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 void */
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: 285af54cf7b3f3ef3f0d673b248c5afbd4cc440e */
2+
* Stub hash: d9110bb238c9edb5c013bd482649ed96e24ff7b6 */
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ 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

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: ae7df94646bf08874d7b9804833d0081c40e0348 */
2+
* Stub hash: da35c3e48b3a09f5f013fdd760ddab6bdfb37967 */
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)