Add more specific array return type hints for various extensions - part 1

ext/bz2, ext/calendar, ext/dba, ext/enchant

Closes GH-7432
This commit is contained in:
Máté Kocsis 2021-08-30 23:25:22 +02:00
parent a2fe8d48b1
commit d02b9b953d
No known key found for this signature in database
GPG key ID: FD055E41728BF310
9 changed files with 49 additions and 5 deletions

View file

@ -30,6 +30,9 @@ static const func_info_t func_infos[] = {
F1("bcpow", MAY_BE_STRING),
F1("bcsqrt", MAY_BE_STRING),
FN("bzopen", MAY_BE_RESOURCE|MAY_BE_FALSE),
F1("bzerror", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING),
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),
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),
F1("curl_copy_handle", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("curl_error", MAY_BE_STRING),
F1("curl_escape", MAY_BE_STRING|MAY_BE_FALSE),
@ -75,6 +78,13 @@ static const func_info_t func_infos[] = {
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),
FN("dba_popen", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("dba_open", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("dba_key_split", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("dba_handlers", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
FN("dba_list", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("enchant_broker_list_dicts", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY),
F1("enchant_broker_describe", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY),
F1("enchant_dict_suggest", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
F1("enchant_dict_describe", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING),
F1("exif_tagname", MAY_BE_STRING|MAY_BE_FALSE),
F1("exif_read_data", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("exif_thumbnail", MAY_BE_STRING|MAY_BE_FALSE),

View file

@ -38,7 +38,11 @@ function bzerrno($bz): int {}
/** @param resource $bz */
function bzerrstr($bz): string {}
/** @param resource $bz */
/**
* @param resource $bz
* @return array<string, int|string>
* @refcount 1
*/
function bzerror($bz): array {}
function bzcompress(string $data, int $block_size = 4, int $work_factor = 0): string|int {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8116780e328f137ca15ae445c9d6b45cf2f41f06 */
* Stub hash: ebd3dc9902075c276828c17dc7a1c3bdc5401f8e */
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
ZEND_ARG_INFO(0, file)

View file

@ -4,8 +4,16 @@
function cal_days_in_month(int $calendar, int $month, int $year): int {}
/**
* @return array<string, int|string|null>
* @refcount 1
*/
function cal_from_jd(int $julian_day, int $calendar): array {}
/**
* @return array<int|string, int|string|array>
* @refcount 1
*/
function cal_info(int $calendar = -1): array {}
function cal_to_jd(int $calendar, int $month, int $day, int $year): int {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: d383ac249ddc88aee4cfaaefd37e85d913281f8e */
* Stub hash: 574dfd0c871b5c71677a3bfa07fd605aea343477 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_days_in_month, 0, 3, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)

View file

@ -36,6 +36,7 @@ function dba_exists($key, $dba): bool {}
*/
function dba_fetch($key, $skip, $dba = UNKNOWN): string|false {}
/** @return array<int, string>|false */
function dba_key_split(string|false|null $key): array|false {}
/** @param resource $dba */
@ -68,6 +69,11 @@ function dba_optimize($dba): bool {}
/** @param resource $dba */
function dba_sync($dba): bool {}
/**
* @return array<int|string, string>
* @refcount 1
*/
function dba_handlers(bool $full_info = false): array {}
/** @return array<int, string> */
function dba_list(): array {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 092664d2d3fa28578e6c8e82160319678c211f0f */
* Stub hash: 670f79f43896b4f0cfd45396bdd8d7a06af1b613 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
ZEND_ARG_INFO(0, path)

View file

@ -31,6 +31,10 @@ function enchant_broker_set_dict_path(EnchantBroker $broker, int $type, string $
/** @deprecated */
function enchant_broker_get_dict_path(EnchantBroker $broker, int $type): string|false {}
/**
* @return array<int, array>
* @refcount 1
*/
function enchant_broker_list_dicts(EnchantBroker $broker): array {}
function enchant_broker_request_dict(EnchantBroker $broker, string $tag): EnchantDictionary|false {}
@ -44,6 +48,10 @@ function enchant_broker_dict_exists(EnchantBroker $broker, string $tag): bool {}
function enchant_broker_set_ordering(EnchantBroker $broker, string $tag, string $ordering): bool {}
/**
* @return array<int, array>
* @refcount 1
*/
function enchant_broker_describe(EnchantBroker $broker): array {}
/** @param array $suggestions */
@ -51,6 +59,10 @@ function enchant_dict_quick_check(EnchantDictionary $dictionary, string $word, &
function enchant_dict_check(EnchantDictionary $dictionary, string $word): bool {}
/**
* @return array<int, string>
* @refcount 1
*/
function enchant_dict_suggest(EnchantDictionary $dictionary, string $word): array {}
function enchant_dict_add(EnchantDictionary $dictionary, string $word): void {}
@ -75,4 +87,8 @@ function enchant_dict_store_replacement(EnchantDictionary $dictionary, string $m
function enchant_dict_get_error(EnchantDictionary $dictionary): string|false {}
/**
* @return array<string, string>
* @refcount 1
*/
function enchant_dict_describe(EnchantDictionary $dictionary): array {}

View file

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 27bafa980508d1a30073d9b009060a7a1953f5af */
* Stub hash: 751d42c599a97854a00ddae296e9b20efeee6a3e */
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_enchant_broker_init, 0, 0, EnchantBroker, MAY_BE_FALSE)
ZEND_END_ARG_INFO()