Skip to content

Commit 55cf0ef

Browse files
committed
Add more specific array return type hints for various extensions - part 2
ext/ftp, ext/gmp, ext/intl
1 parent dad5cfa commit 55cf0ef

19 files changed

+54
-10
lines changed

Zend/Optimizer/zend_func_infos.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ static const func_info_t func_infos[] = {
8585
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),
8686
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),
8787
F1("filter_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
88+
FN("ftp_raw", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
89+
FN("ftp_nlist", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
90+
FN("ftp_rawlist", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
91+
FN("ftp_mlsd", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),
8892
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),
8993
F1("imagecreatetruecolor", MAY_BE_OBJECT|MAY_BE_FALSE),
9094
#if defined(PHP_WIN32)
@@ -153,6 +157,10 @@ static const func_info_t func_infos[] = {
153157
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
154158
F1("bind_textdomain_codeset", MAY_BE_STRING|MAY_BE_FALSE),
155159
#endif
160+
FN("gmp_div_qr", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
161+
FN("gmp_sqrtrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
162+
FN("gmp_rootrem", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_OBJECT),
163+
FN("gmp_gcdext", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_OBJECT),
156164
F1("hash", MAY_BE_STRING|MAY_BE_FALSE),
157165
F1("hash_file", MAY_BE_STRING|MAY_BE_FALSE),
158166
F1("hash_hmac", MAY_BE_STRING|MAY_BE_FALSE),
@@ -179,6 +187,13 @@ static const func_info_t func_infos[] = {
179187
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),
180188
F1("iconv", MAY_BE_STRING|MAY_BE_FALSE),
181189
F1("iconv_get_encoding", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_STRING|MAY_BE_FALSE),
190+
FN("intlcal_get_available_locales", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
191+
FN("datefmt_localtime", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
192+
FN("locale_get_keywords", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE|MAY_BE_NULL),
193+
FN("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),
194+
FN("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),
195+
FN("resourcebundle_locales", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
196+
FN("transliterator_list_ids", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
182197
F1("json_encode", MAY_BE_STRING|MAY_BE_FALSE),
183198
F1("json_last_error_msg", MAY_BE_STRING),
184199
F1("mb_language", MAY_BE_STRING|MAY_BE_BOOL),

ext/ftp/ftp.stub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,25 @@ 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+
/** @return array<int, string> */
3032
function ftp_raw(FTP\Connection $ftp, string $command): array {}
3133
function ftp_mkdir(FTP\Connection $ftp, string $directory): string|false {}
3234
function ftp_rmdir(FTP\Connection $ftp, string $directory): bool {}
3335
function ftp_chmod(FTP\Connection $ftp, int $permissions, string $filename): int|false {}
3436

3537
/** @param string $response */
3638
function ftp_alloc(FTP\Connection $ftp, int $size, &$response = null): bool {}
39+
40+
/** @return array<int, string>|false */
3741
function ftp_nlist(FTP\Connection $ftp, string $directory): array|false {}
42+
43+
/** @return array<int, string>|false */
3844
function ftp_rawlist(FTP\Connection $ftp, string $directory, bool $recursive = false): array|false {}
45+
46+
/** @return array<int, array>|false */
3947
function ftp_mlsd(FTP\Connection $ftp, string $directory): array|false {}
48+
4049
function ftp_systype(FTP\Connection $ftp): string|false {}
4150

4251
/** @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: bfc9846eb1f74990ec9b406728efff66fe49295f */
2+
* Stub hash: 0172b22ffb6404158e8c2075e3dc13e310f3bc32 */
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ 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+
/** @return array<int, GMP> */
2526
function gmp_div_qr(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): array {}
2627

2728
function gmp_div_q(GMP|int|string $num1, GMP|int|string $num2, int $rounding_mode = GMP_ROUND_ZERO): GMP {}
@@ -43,10 +44,12 @@ function gmp_fact(GMP|int|string $num): GMP {}
4344

4445
function gmp_sqrt(GMP|int|string $num): GMP {}
4546

47+
/** @return array<int, GMP> */
4648
function gmp_sqrtrem(GMP|int|string $num): array {}
4749

4850
function gmp_root(GMP|int|string $num, int $nth): GMP {}
4951

52+
/** @return array<int, GMP> */
5053
function gmp_rootrem(GMP|int|string $num, int $nth): array {}
5154

5255
function gmp_pow(GMP|int|string $num, int $exponent): GMP {}
@@ -61,6 +64,7 @@ function gmp_prob_prime(GMP|int|string $num, int $repetitions = 10): int {}
6164

6265
function gmp_gcd(GMP|int|string $num1, GMP|int|string $num2): GMP {}
6366

67+
/** @return array<string, GMP> */
6468
function gmp_gcdext(GMP|int|string $num1, GMP|int|string $num2): array {}
6569

6670
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: 7e2458ac4958923dfd43bde52cb111dd1c59f032 */
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: 1f47fca82af35929e8cbcb9b2b9979c4c03f658c */
2+
* Stub hash: 04624e01ceac2d7d629fc205ccde74baeba11a6d */
33

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

ext/intl/dateformat/dateformat.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function parse(string $string, &$offset = null): int|float|false {}
134134

135135
/**
136136
* @param int $offset
137+
* @return array<string, int>|false
137138
* @tentative-return-type
138139
* @alias datefmt_localtime
139140
*/

ext/intl/dateformat/dateformat_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: 767e5d064aef6d68f860a79c721eb728436c4eb9 */
2+
* Stub hash: 82f90e7b0528b2b3515c086763dba4de0f92dfa7 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)

ext/intl/locale/locale.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static function getScript(string $locale): ?string {}
3535
public static function getRegion(string $locale): ?string {}
3636

3737
/**
38+
* @return array<string, string>|false|null
3839
* @tentative-return-type
3940
* @alias locale_get_keywords
4041
*/

ext/intl/locale/locale_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: a0c2cf74b0d2e8309f0cd39fd9969d14586d0988 */
2+
* Stub hash: 539e559bc038e18358540b3b3f4db7b09e532dae */
33

44
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Locale_getDefault, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()

ext/intl/msgformat/msgformat.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ public function format(array $values): string|false {}
2525
public static function formatMessage(string $locale, string $pattern, array $values): string|false {}
2626

2727
/**
28+
* @return array<int, int|float|string>|false
2829
* @tentative-return-type
2930
* @alias msgfmt_parse
3031
*/
3132
public function parse(string $string): array|false {}
3233

3334
/**
35+
* @return array<int, int|float|string>|false
3436
* @tentative-return-type
3537
* @alias msgfmt_parse_message
3638
*/

ext/intl/msgformat/msgformat_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: 3fc29ffe87caf85a84e97470d0b59a26c801457c */
2+
* Stub hash: 44bc7b87c0b6c674bf94764b3f036006e3933713 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter___construct, 0, 0, 2)
55
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)

ext/intl/php_intl.stub.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function intlcal_get_keyword_values_for_locale(string $keyword, string $locale,
1515

1616
function intlcal_get_now(): float {}
1717

18+
/** @return array<int, string> */
1819
function intlcal_get_available_locales(): array {}
1920

2021
function intlcal_get(IntlCalendar $calendar, int $field): int|false {}
@@ -206,7 +207,10 @@ function datefmt_format_object($datetime, $format = null, ?string $locale = null
206207
/** @param int $offset */
207208
function datefmt_parse(IntlDateFormatter $formatter, string $string, &$offset = null): int|float|false {}
208209

209-
/** @param int $offset */
210+
/**
211+
* @param int $offset
212+
* @return array<string, int>|false
213+
*/
210214
function datefmt_localtime(IntlDateFormatter $formatter, string $string, &$offset = null): array|false {}
211215

212216
function datefmt_get_error_code(IntlDateFormatter $formatter): int {}
@@ -294,6 +298,7 @@ function locale_get_script(string $locale): ?string {}
294298

295299
function locale_get_region(string $locale): ?string {}
296300

301+
/** @return array<string, string>|false|null */
297302
function locale_get_keywords(string $locale): array|false|null {}
298303

299304
function locale_get_display_script(string $locale, ?string $displayLocale = null): string|false {}
@@ -328,8 +333,10 @@ function msgfmt_format(MessageFormatter $formatter, array $values): string|false
328333

329334
function msgfmt_format_message(string $locale, string $pattern, array $values): string|false {}
330335

336+
/** @return array<int, int|float|string>|false */
331337
function msgfmt_parse(MessageFormatter $formatter, string $string): array|false {}
332338

339+
/** @return array<int, int|float|string>|false */
333340
function msgfmt_parse_message(string $locale, string $pattern, string $message): array|false {}
334341

335342
function msgfmt_set_pattern(MessageFormatter $formatter, string $pattern): bool {}
@@ -361,6 +368,7 @@ function resourcebundle_get(ResourceBundle $bundle, $index, bool $fallback = tru
361368

362369
function resourcebundle_count(ResourceBundle $bundle): int {}
363370

371+
/** @return array<int, string>|false */
364372
function resourcebundle_locales(string $bundle): array|false {}
365373

366374
function resourcebundle_get_error_code(ResourceBundle $bundle): int {}
@@ -431,6 +439,7 @@ function transliterator_create(string $id, int $direction = Transliterator::FORW
431439

432440
function transliterator_create_from_rules(string $rules, int $direction = Transliterator::FORWARD): ?Transliterator {}
433441

442+
/** @return array<int, string>|false */
434443
function transliterator_list_ids(): array|false {}
435444

436445
function transliterator_create_inverse(Transliterator $transliterator): ?Transliterator {}

ext/intl/php_intl_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: dd2cb2b1ffd2e72d24ff006b6f235e3cf501b0fb */
2+
* Stub hash: c87e0d93e422c86ba0f588388e1fe734e6ce515a */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
55
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")

ext/intl/resourcebundle/resourcebundle.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function get($index, bool $fallback = true): mixed {}
2626
public function count(): int {}
2727

2828
/**
29+
* @return array<int, string>|false
2930
* @tentative-return-type
3031
* @alias resourcebundle_locales
3132
*/

ext/intl/resourcebundle/resourcebundle_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: a299d2a45a3575e6da71560979e2f9301b3c952f */
2+
* Stub hash: d27fa5a4dc092b94e48fc876070f440c247fa6c2 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle___construct, 0, 0, 2)
55
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)

ext/intl/transliterator/transliterator.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static function createFromRules(string $rules, int $direction = Translite
2727
public function createInverse(): ?Transliterator {}
2828

2929
/**
30+
* @return array<int, string>|false
3031
* @tentative-return-type
3132
* @alias transliterator_list_ids
3233
*/

ext/intl/transliterator/transliterator_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: fbc9a196271c276e5af658115571cacde2ad3a3a */
2+
* Stub hash: 8a6aaab7dd89a014726bd1fdf1f40f7b6fa98ea5 */
33

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

0 commit comments

Comments
 (0)