Skip to content

Commit 5f80eb7

Browse files
committed
Fix required number of arguments in stubs
* get_parent_class() argument is optional * Mark array_filter() $callback as optional * The $base of gmp_strval() is optional * DateTime constructor also accepts zero arguments * hash_update_file() stream context is optional * xmlwriter_write_dtd_entity() $isparam argument is optional
1 parent c9d4696 commit 5f80eb7

13 files changed

+19
-21
lines changed

Zend/zend_builtin_functions.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function get_class(object $object = UNKNOWN) {}
3030
function get_called_class() {}
3131

3232
/** @return string|false */
33-
function get_parent_class($object) {}
33+
function get_parent_class($object = UNKNOWN) {}
3434

3535
function is_subclass_of($object, string $class_name, bool $allow_string = true): bool {}
3636

Zend/zend_builtin_functions_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ZEND_END_ARG_INFO()
4848

4949
#define arginfo_get_called_class arginfo_func_get_args
5050

51-
ZEND_BEGIN_ARG_INFO_EX(arginfo_get_parent_class, 0, 0, 1)
51+
ZEND_BEGIN_ARG_INFO_EX(arginfo_get_parent_class, 0, 0, 0)
5252
ZEND_ARG_INFO(0, object)
5353
ZEND_END_ARG_INFO()
5454

ext/date/php_date.stub.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ function localtime(int $timestamp = UNKNOWN, bool $associative = false): array {
3838
function getdate(int $timestamp = UNKNOWN): array {}
3939

4040
/** @return DateTime|false */
41-
function date_create(string $time, ?DateTimeZone $timezone = null) {}
41+
function date_create(string $time = "now", ?DateTimeZone $timezone = null) {}
4242

4343
/** @return DateTime|false */
44-
function date_create_immutable(string $time, ?DateTimeZone $timezone = null) {}
44+
function date_create_immutable(string $time = "now", ?DateTimeZone $timezone = null) {}
4545

4646
/** @return DateTime|false */
4747
function date_create_from_format(string $format, string $time, ?DateTimeZone $timezone = null) {}
@@ -158,7 +158,7 @@ public function __wakeup();
158158
}
159159

160160
class DateTime implements DateTimeInterface {
161-
public function __construct(string $time, ?DateTimeZone $timezone = null);
161+
public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
162162

163163
/** @return DateTime */
164164
public static function __set_state(array $array);
@@ -195,11 +195,11 @@ public function setDate(int $year, int $month, int $day);
195195
public function setISODate(int $year, int $week, int $day = 1);
196196

197197
/** @return DateTime */
198-
public function setTimestamp(int $timestampt);
198+
public function setTimestamp(int $timestamp);
199199
}
200200

201201
class DateTimeImmutable implements DateTimeInterface {
202-
public function __construct(string $time, ?DateTimeZone $timezone = null);
202+
public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
203203

204204
/** @return DateTimeZone */
205205
public static function __set_state(array $array);

ext/date/php_date_arginfo.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getdate, 0, 0, IS_ARRAY, 0)
5050
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
5151
ZEND_END_ARG_INFO()
5252

53-
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 1)
53+
ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0)
5454
ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
5555
ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
5656
ZEND_END_ARG_INFO()
@@ -279,7 +279,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setISODate, 0, 0, 2)
279279
ZEND_END_ARG_INFO()
280280

281281
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimestamp, 0, 0, 1)
282-
ZEND_ARG_TYPE_INFO(0, timestampt, IS_LONG, 0)
282+
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
283283
ZEND_END_ARG_INFO()
284284

285285
#define arginfo_class_DateTimeImmutable___construct arginfo_date_create
@@ -304,9 +304,7 @@ ZEND_END_ARG_INFO()
304304

305305
#define arginfo_class_DateTimeImmutable_setISODate arginfo_class_DateTime_setISODate
306306

307-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_setTimestamp, 0, 0, 1)
308-
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
309-
ZEND_END_ARG_INFO()
307+
#define arginfo_class_DateTimeImmutable_setTimestamp arginfo_class_DateTime_setTimestamp
310308

311309
#define arginfo_class_DateTimeZone___construct arginfo_timezone_open
312310

ext/gmp/gmp.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function gmp_intval($gmpnumber): int {}
2222
* @param GMP|int|bool|string $gmpnumber
2323
* @return GMP|false
2424
*/
25-
function gmp_strval($gmpnumber, int $base) {}
25+
function gmp_strval($gmpnumber, int $base = 10) {}
2626

2727
/**
2828
* @param GMP|int|bool|string $a

ext/gmp/gmp_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_intval, 0, 1, IS_LONG, 0)
2121
ZEND_ARG_INFO(0, gmpnumber)
2222
ZEND_END_ARG_INFO()
2323

24-
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 2)
24+
ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 1)
2525
ZEND_ARG_INFO(0, gmpnumber)
2626
ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
2727
ZEND_END_ARG_INFO()

ext/hash/hash.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function hash_update(HashContext $context, string $data): bool {}
2121
function hash_update_stream(HashContext $context, $handle, int $length = -1): int {}
2222

2323
/** @param resource $stream_context */
24-
function hash_update_file(HashContext $context, string $filename, $stream_context): bool {}
24+
function hash_update_file(HashContext $context, string $filename, $stream_context = UNKNOWN): bool {}
2525

2626
function hash_final(HashContext $context, bool $raw_output = false): string {}
2727

ext/hash/hash_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_stream, 0, 2, IS_LON
3838
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
3939
ZEND_END_ARG_INFO()
4040

41-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_file, 0, 3, _IS_BOOL, 0)
41+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_file, 0, 2, _IS_BOOL, 0)
4242
ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
4343
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
4444
ZEND_ARG_INFO(0, stream_context)

ext/standard/array.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6044,7 +6044,7 @@ PHP_FUNCTION(array_reduce)
60446044
}
60456045
/* }}} */
60466046

6047-
/* {{{ proto array array_filter(array input [, mixed callback])
6047+
/* {{{ proto array array_filter(array input [, mixed callback [, int use_type]])
60486048
Filters elements from the array via the callback. */
60496049
PHP_FUNCTION(array_filter)
60506050
{

ext/standard/basic_functions.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ function array_product(array $arg) {}
254254

255255
function array_reduce(array $arg, callable $callback, $initial = null) {}
256256

257-
function array_filter(array $arg, callable $callback, int $use_keys = 0): array {}
257+
function array_filter(array $arg, callable $callback = UNKNOWN, int $use_keys = 0): array {}
258258

259259
function array_map(?callable $callback, array $arr1, array ...$arrays): array {}
260260

ext/standard/basic_functions_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
327327
ZEND_ARG_INFO(0, initial)
328328
ZEND_END_ARG_INFO()
329329

330-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 2, IS_ARRAY, 0)
330+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0)
331331
ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
332332
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
333333
ZEND_ARG_TYPE_INFO(0, use_keys, IS_LONG, 0)

ext/xmlwriter/xmlwriter.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function xmlwriter_start_dtd_entity(XMLWriter $xmlwriter, string $name, bool $is
8080

8181
function xmlwriter_end_dtd_entity(XMLWriter $xmlwriter): bool {}
8282

83-
function xmlwriter_write_dtd_entity(XMLWriter $xmlwriter, string $name, string $content, bool $isparam, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
83+
function xmlwriter_write_dtd_entity(XMLWriter $xmlwriter, string $name, string $content, bool $isparam = false, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
8484

8585
function xmlwriter_output_memory(XMLWriter $xmlwriter, bool $flush = true): string {}
8686

ext/xmlwriter/xmlwriter_arginfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ ZEND_END_ARG_INFO()
159159

160160
#define arginfo_xmlwriter_end_dtd_entity arginfo_xmlwriter_start_comment
161161

162-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 4, _IS_BOOL, 0)
162+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 3, _IS_BOOL, 0)
163163
ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
164164
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
165165
ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)

0 commit comments

Comments
 (0)