Skip to content

Commit d608319

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Add more specific array return type hints for various extensions - part 2 Add the --generate-optimizer-info option to the help of gen_stub.php
2 parents f34a3d3 + baac970 commit d608319

22 files changed

+107
-14
lines changed

Zend/Optimizer/zend_func_infos.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ static const func_info_t func_infos[] = {
9595
F1("filter_input_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF|MAY_BE_FALSE|MAY_BE_NULL),
9696
F1("filter_var_array", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF|MAY_BE_FALSE|MAY_BE_NULL),
9797
F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
98+
F1("ftp_raw", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_NULL),
99+
F1("ftp_nlist", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
100+
F1("ftp_rawlist", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
101+
F1("ftp_mlsd", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
98102
F1("gd_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE),
99103
F1("imagecreatetruecolor", MAY_BE_OBJECT|MAY_BE_FALSE),
100104
#if defined(PHP_WIN32)
@@ -163,6 +167,10 @@ static const func_info_t func_infos[] = {
163167
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
164168
F1("bind_textdomain_codeset", MAY_BE_STRING|MAY_BE_FALSE),
165169
#endif
170+
F1("gmp_div_qr", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
171+
F1("gmp_sqrtrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
172+
F1("gmp_rootrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
173+
F1("gmp_gcdext", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_OBJECT),
166174
F1("hash", MAY_BE_STRING|MAY_BE_FALSE),
167175
F1("hash_file", MAY_BE_STRING|MAY_BE_FALSE),
168176
F1("hash_hmac", MAY_BE_STRING|MAY_BE_FALSE),
@@ -189,6 +197,13 @@ static const func_info_t func_infos[] = {
189197
F1("iconv_mime_decode_headers", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
190198
F1("iconv", MAY_BE_STRING|MAY_BE_FALSE),
191199
F1("iconv_get_encoding", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_STRING|MAY_BE_FALSE),
200+
F1("intlcal_get_available_locales", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
201+
F1("datefmt_localtime", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
202+
F1("locale_get_keywords", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE|MAY_BE_NULL),
203+
F1("msgfmt_parse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_DOUBLE|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
204+
F1("msgfmt_parse_message", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_DOUBLE|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
205+
F1("resourcebundle_locales", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
206+
F1("transliterator_list_ids", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
192207
F1("json_encode", MAY_BE_STRING|MAY_BE_FALSE),
193208
F1("json_last_error_msg", MAY_BE_STRING),
194209
F1("ldap_get_entries", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),

build/gen_stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ function initPhpParser() {
33103310
}
33113311

33123312
if (isset($options["h"]) || isset($options["help"])) {
3313-
die("\nusage: gen_stub.php [ -f | --force-regeneration ] [ --generate-classsynopses ] [ --replace-classsynopses ] [ --generate-methodsynopses ] [ --replace-methodsynopses ] [ --parameter-stats ] [ --verify ] [ -h | --help ] [ name.stub.php | directory ] [ directory ]\n\n");
3313+
die("\nusage: gen_stub.php [ -f | --force-regeneration ] [ --generate-classsynopses ] [ --replace-classsynopses ] [ --generate-methodsynopses ] [ --replace-methodsynopses ] [ --parameter-stats ] [ --verify ] [ --generate-optimizer-info ] [ -h | --help ] [ name.stub.php | directory ] [ directory ]\n\n");
33143314
}
33153315

33163316
$fileInfos = [];

ext/ftp/ftp.stub.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,37 @@ function ftp_pwd(FTP\Connection $ftp): string|false {}
2727
function ftp_cdup(FTP\Connection $ftp): bool {}
2828
function ftp_chdir(FTP\Connection $ftp, string $directory): bool {}
2929
function ftp_exec(FTP\Connection $ftp, string $command): bool {}
30+
31+
/**
32+
* @return array<int, string>|null
33+
* @refcount 1
34+
*/
3035
function ftp_raw(FTP\Connection $ftp, string $command): ?array {}
3136
function ftp_mkdir(FTP\Connection $ftp, string $directory): string|false {}
3237
function ftp_rmdir(FTP\Connection $ftp, string $directory): bool {}
3338
function ftp_chmod(FTP\Connection $ftp, int $permissions, string $filename): int|false {}
3439

3540
/** @param string $response */
3641
function ftp_alloc(FTP\Connection $ftp, int $size, &$response = null): bool {}
42+
43+
/**
44+
* @return array<int, string>|false
45+
* @refcount 1
46+
*/
3747
function ftp_nlist(FTP\Connection $ftp, string $directory): array|false {}
48+
49+
/**
50+
* @return array<int, string>|false
51+
* @refcount 1
52+
*/
3853
function ftp_rawlist(FTP\Connection $ftp, string $directory, bool $recursive = false): array|false {}
54+
55+
/**
56+
* @return array<int, array>|false
57+
* @refcount 1
58+
*/
3959
function ftp_mlsd(FTP\Connection $ftp, string $directory): array|false {}
60+
4061
function ftp_systype(FTP\Connection $ftp): string|false {}
4162

4263
/** @param resource $stream */

ext/ftp/ftp_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: 6de0997e9f07a8e1079764ab1841d3ac4651cc53 */
2+
* Stub hash: 2b1726dd5652839a37e533e20dfcf6782b3c766d */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTP\\Connection, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)

ext/gmp/gmp.stub.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ function gmp_sub(GMP|int|string $num1, GMP|int|string $num2): GMP {}
2222

2323
function gmp_mul(GMP|int|string $num1, GMP|int|string $num2): GMP {}
2424

25+
/**
26+
* @return array<int, GMP>
27+
* @refcount 1
28+
*/
2529
function gmp_div_qr(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): array {}
2630

2731
function gmp_div_q(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP {}
@@ -43,10 +47,18 @@ function gmp_fact(GMP|int|string $num): GMP {}
4347

4448
function gmp_sqrt(GMP|int|string $num): GMP {}
4549

50+
/**
51+
* @return array<int, GMP>
52+
* @refcount 1
53+
*/
4654
function gmp_sqrtrem(GMP|int|string $num): array {}
4755

4856
function gmp_root(GMP|int|string $num, int $nth): GMP {}
4957

58+
/**
59+
* @return array<int, GMP>
60+
* @refcount 1
61+
*/
5062
function gmp_rootrem(GMP|int|string $num, int $nth): array {}
5163

5264
function gmp_pow(GMP|int|string $num, int $exponent): GMP {}
@@ -61,6 +73,10 @@ function gmp_prob_prime(GMP|int|string $num, int $repetitions = 10): int {}
6173

6274
function gmp_gcd(GMP|int|string $num1, GMP|int|string $num2): GMP {}
6375

76+
/**
77+
* @return array<string, GMP>
78+
* @refcount 1
79+
*/
6480
function gmp_gcdext(GMP|int|string $num1, GMP|int|string $num2): array {}
6581

6682
function gmp_lcm(GMP|int|string $num1, GMP|int|string $num2): GMP {}

ext/gmp/gmp_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: 69215fb94adb4156c974360e5698e842471cb27d */
2+
* Stub hash: 05e618ec428bd8769410153469c42cbc923ea77f */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_gmp_init, 0, 1, GMP, 0)
55
ZEND_ARG_TYPE_MASK(0, num, MAY_BE_LONG|MAY_BE_STRING, NULL)

ext/intl/calendar/calendar.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function getActualMaximum(int $field): int|false {}
7474
public function getActualMinimum(int $field): int|false {}
7575

7676
/**
77+
* @return array<int, string>
7778
* @tentative-return-type
7879
* @alias intlcal_get_available_locales
7980
*/

ext/intl/calendar/calendar_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: 2265c2a4f478d6ccd576ce09a19a158df38a2bdb */
2+
* Stub hash: 7be0e49d2b898587c4bbefaaf613932ae4786c52 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
55
ZEND_END_ARG_INFO()

ext/intl/converter/converter.stub.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ public function convert(string $str, bool $reverse = false): string|false {}
1515
*/
1616
public function fromUCallback(int $reason, array $source, int $codePoint, &$error): string|int|array|null {}
1717

18-
/** @tentative-return-type */
18+
/**
19+
* @return array<int, string>|false|null
20+
* @tentative-return-type
21+
*/
1922
public static function getAliases(string $name): array|false|null {}
2023

21-
/** @tentative-return-type */
24+
/**
25+
* @return array<int, string>
26+
* @tentative-return-type
27+
*/
2228
public static function getAvailable(): array {}
2329

2430
/** @tentative-return-type */

ext/intl/converter/converter_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: a6b352ba1b6ad2367bd4705ac941e763f74c8fac */
2+
* Stub hash: 2a6d8499e1a2d414130e366783a1c084f47a3293 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null")

0 commit comments

Comments
 (0)