Skip to content

Commit d02b9b9

Browse files
committed
Add more specific array return type hints for various extensions - part 1
ext/bz2, ext/calendar, ext/dba, ext/enchant Closes GH-7432
1 parent a2fe8d4 commit d02b9b9

File tree

9 files changed

+49
-5
lines changed

9 files changed

+49
-5
lines changed

Zend/Optimizer/zend_func_infos.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ static const func_info_t func_infos[] = {
3030
F1("bcpow", MAY_BE_STRING),
3131
F1("bcsqrt", MAY_BE_STRING),
3232
FN("bzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
33+
F1("bzerror", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
34+
F1("cal_from_jd", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_NULL),
35+
F1("cal_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY),
3336
F1("curl_copy_handle", MAY_BE_OBJECT|MAY_BE_FALSE),
3437
F1("curl_error", MAY_BE_STRING),
3538
F1("curl_escape", MAY_BE_STRING|MAY_BE_FALSE),
@@ -75,6 +78,13 @@ static const func_info_t func_infos[] = {
7578
F1("date_sun_info", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE|MAY_BE_ARRAY_OF_LONG),
7679
FN("dba_popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
7780
FN("dba_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
81+
FN("dba_key_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
82+
F1("dba_handlers", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
83+
FN("dba_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
84+
F1("enchant_broker_list_dicts", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY),
85+
F1("enchant_broker_describe", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY),
86+
F1("enchant_dict_suggest", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
87+
F1("enchant_dict_describe", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
7888
F1("exif_tagname", MAY_BE_STRING|MAY_BE_FALSE),
7989
F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
8090
F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE),

ext/bz2/bz2.stub.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ function bzerrno($bz): int {}
3838
/** @param resource $bz */
3939
function bzerrstr($bz): string {}
4040

41-
/** @param resource $bz */
41+
/**
42+
* @param resource $bz
43+
* @return array<string, int|string>
44+
* @refcount 1
45+
*/
4246
function bzerror($bz): array {}
4347

4448
function bzcompress(string $data, int $block_size = 4, int $work_factor = 0): string|int {}

ext/bz2/bz2_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: 8116780e328f137ca15ae445c9d6b45cf2f41f06 */
2+
* Stub hash: ebd3dc9902075c276828c17dc7a1c3bdc5401f8e */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
55
ZEND_ARG_INFO(0, file)

ext/calendar/calendar.stub.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44

55
function cal_days_in_month(int $calendar, int $month, int $year): int {}
66

7+
/**
8+
* @return array<string, int|string|null>
9+
* @refcount 1
10+
*/
711
function cal_from_jd(int $julian_day, int $calendar): array {}
812

13+
/**
14+
* @return array<int|string, int|string|array>
15+
* @refcount 1
16+
*/
917
function cal_info(int $calendar = -1): array {}
1018

1119
function cal_to_jd(int $calendar, int $month, int $day, int $year): int {}

ext/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: d383ac249ddc88aee4cfaaefd37e85d913281f8e */
2+
* Stub hash: 574dfd0c871b5c71677a3bfa07fd605aea343477 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_days_in_month, 0, 3, IS_LONG, 0)
55
ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)

ext/dba/dba.stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function dba_exists($key, $dba): bool {}
3636
*/
3737
function dba_fetch($key, $skip, $dba = UNKNOWN): string|false {}
3838

39+
/** @return array<int, string>|false */
3940
function dba_key_split(string|false|null $key): array|false {}
4041

4142
/** @param resource $dba */
@@ -68,6 +69,11 @@ function dba_optimize($dba): bool {}
6869
/** @param resource $dba */
6970
function dba_sync($dba): bool {}
7071

72+
/**
73+
* @return array<int|string, string>
74+
* @refcount 1
75+
*/
7176
function dba_handlers(bool $full_info = false): array {}
7277

78+
/** @return array<int, string> */
7379
function dba_list(): array {}

ext/dba/dba_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: 092664d2d3fa28578e6c8e82160319678c211f0f */
2+
* Stub hash: 670f79f43896b4f0cfd45396bdd8d7a06af1b613 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
55
ZEND_ARG_INFO(0, path)

ext/enchant/enchant.stub.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ function enchant_broker_set_dict_path(EnchantBroker $broker, int $type, string $
3131
/** @deprecated */
3232
function enchant_broker_get_dict_path(EnchantBroker $broker, int $type): string|false {}
3333

34+
/**
35+
* @return array<int, array>
36+
* @refcount 1
37+
*/
3438
function enchant_broker_list_dicts(EnchantBroker $broker): array {}
3539

3640
function enchant_broker_request_dict(EnchantBroker $broker, string $tag): EnchantDictionary|false {}
@@ -44,13 +48,21 @@ function enchant_broker_dict_exists(EnchantBroker $broker, string $tag): bool {}
4448

4549
function enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string $ordering): bool {}
4650

51+
/**
52+
* @return array<int, array>
53+
* @refcount 1
54+
*/
4755
function enchant_broker_describe(EnchantBroker $broker): array {}
4856

4957
/** @param array $suggestions */
5058
function enchant_dict_quick_check(EnchantDictionary $dictionary, string $word, &$suggestions = null): bool {}
5159

5260
function enchant_dict_check(EnchantDictionary $dictionary, string $word): bool {}
5361

62+
/**
63+
* @return array<int, string>
64+
* @refcount 1
65+
*/
5466
function enchant_dict_suggest(EnchantDictionary $dictionary, string $word): array {}
5567

5668
function enchant_dict_add(EnchantDictionary $dictionary, string $word): void {}
@@ -75,4 +87,8 @@ function enchant_dict_store_replacement(EnchantDictionary $dictionary, string $m
7587

7688
function enchant_dict_get_error(EnchantDictionary $dictionary): string|false {}
7789

90+
/**
91+
* @return array<string, string>
92+
* @refcount 1
93+
*/
7894
function enchant_dict_describe(EnchantDictionary $dictionary): array {}

ext/enchant/enchant_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: 27bafa980508d1a30073d9b009060a7a1953f5af */
2+
* Stub hash: 751d42c599a97854a00ddae296e9b20efeee6a3e */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
55
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)