From 27e83d0fb87c04b61441fb77e963dd4e14ad187e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 8 Nov 2019 23:29:12 +0100 Subject: Add union return types for function stubs --- Zend/zend_builtin_functions.stub.php | 21 +- Zend/zend_builtin_functions_arginfo.h | 15 +- Zend/zend_generators_arginfo.h | 12 +- ext/bcmath/bcmath.stub.php | 3 +- ext/bcmath/bcmath_arginfo.h | 2 +- ext/bz2/bz2.stub.php | 34 ++-- ext/bz2/bz2_arginfo.h | 8 +- ext/calendar/calendar.stub.php | 6 +- ext/calendar/calendar_arginfo.h | 4 +- ext/com_dotnet/com_extension.stub.php | 3 +- ext/com_dotnet/com_extension_arginfo.h | 2 +- ext/curl/curl.stub.php | 44 +---- ext/curl/curl_arginfo.h | 10 +- ext/date/php_date.stub.php | 42 ++-- ext/date/php_date_arginfo.h | 65 ++++--- ext/dba/dba.stub.php | 20 +- ext/dba/dba_arginfo.h | 6 +- ext/enchant/enchant.stub.php | 14 +- ext/enchant/enchant_arginfo.h | 4 +- ext/exif/exif.stub.php | 12 +- ext/exif/exif_arginfo.h | 8 +- ext/fileinfo/fileinfo.stub.php | 9 +- ext/fileinfo/fileinfo_arginfo.h | 6 +- ext/filter/filter.stub.php | 5 +- ext/filter/filter_arginfo.h | 2 +- ext/ftp/ftp.stub.php | 71 ++----- ext/ftp/ftp_arginfo.h | 23 ++- ext/gd/gd.stub.php | 53 ++--- ext/gd/gd_arginfo.h | 32 ++-- ext/gettext/gettext.stub.php | 27 +-- ext/gettext/gettext_arginfo.h | 18 +- ext/gmp/gmp.stub.php | 87 +++------ ext/gmp/gmp_arginfo.h | 52 +++-- ext/hash/hash.stub.php | 25 +-- ext/hash/hash_arginfo.h | 16 +- ext/iconv/iconv.stub.php | 27 +-- ext/iconv/iconv_arginfo.h | 18 +- ext/imap/php_imap.stub.php | 222 ++++++--------------- ext/imap/php_imap_arginfo.h | 61 +++--- ext/intl/timezone/timezone.stub.php | 39 ++-- ext/intl/timezone/timezone_arginfo.h | 44 +++-- ext/json/json.stub.php | 3 +- ext/json/json_arginfo.h | 2 +- ext/ldap/ldap.stub.php | 75 ++------ ext/ldap/ldap_arginfo.h | 25 +-- ext/mbstring/mbstring.stub.php | 159 +++++---------- ext/mbstring/mbstring_arginfo.h | 77 ++++---- ext/odbc/odbc.stub.php | 87 +++------ ext/odbc/odbc_arginfo.h | 30 +-- ext/opcache/opcache.stub.php | 6 +- ext/opcache/opcache_arginfo.h | 4 +- ext/openssl/openssl.stub.php | 81 +++----- ext/openssl/openssl_arginfo.h | 45 +++-- ext/pcntl/pcntl.stub.php | 19 +- ext/pcntl/pcntl_arginfo.h | 8 +- ext/pcre/php_pcre.stub.php | 31 +-- ext/pcre/php_pcre_arginfo.h | 20 +- ext/posix/posix.stub.php | 44 ++--- ext/posix/posix_arginfo.h | 27 +-- ext/pspell/pspell.stub.php | 12 +- ext/pspell/pspell_arginfo.h | 8 +- ext/readline/readline.stub.php | 3 +- ext/readline/readline_arginfo.h | 2 +- ext/session/session.stub.php | 27 +-- ext/session/session_arginfo.h | 24 +-- ext/shmop/shmop.stub.php | 26 +-- ext/shmop/shmop_arginfo.h | 4 +- ext/snmp/snmp.stub.php | 100 +++------- ext/snmp/snmp_arginfo.h | 8 +- ext/sockets/sockets.stub.php | 97 +++------- ext/sockets/sockets_arginfo.h | 26 +-- ext/sodium/libsodium.stub.php | 27 +-- ext/sodium/libsodium_arginfo.h | 14 +- ext/standard/basic_functions.stub.php | 341 +++++++++++---------------------- ext/standard/basic_functions_arginfo.h | 202 ++++++++++--------- ext/sysvmsg/sysvmsg.stub.php | 7 +- ext/sysvmsg/sysvmsg_arginfo.h | 2 +- ext/tidy/tidy.stub.php | 23 +-- ext/tidy/tidy_arginfo.h | 10 +- ext/tokenizer/tokenizer.stub.php | 3 +- ext/tokenizer/tokenizer_arginfo.h | 2 +- ext/xmlwriter/xmlwriter.stub.php | 3 +- ext/xmlwriter/xmlwriter_arginfo.h | 2 +- ext/zip/php_zip.stub.php | 35 +--- ext/zip/php_zip_arginfo.h | 10 +- ext/zlib/zlib.stub.php | 124 ++++-------- ext/zlib/zlib_arginfo.h | 35 ++-- sapi/cli/tests/006.phpt | 8 + sapi/phpdbg/phpdbg.stub.php | 3 +- sapi/phpdbg/phpdbg_arginfo.h | 2 +- scripts/dev/gen_stub.php | 2 + 91 files changed, 1198 insertions(+), 1909 deletions(-) diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index c3052db108..57c3f5830c 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -7,15 +7,13 @@ function func_num_args(): int {} /** @return mixed */ function func_get_arg(int $arg_num) {} -/** @return array|false */ -function func_get_args() {} +function func_get_args(): array|false {} function strlen(string $str): int {} function strcmp(string $str1, string $str2): int {} -/** @return int|false */ -function strncmp(string $str1, string $str2, int $len) {} +function strncmp(string $str1, string $str2, int $len): int|false {} function error_reporting($new_error_level = UNKNOWN): int {} @@ -23,21 +21,17 @@ function define(string $constant_name, $value, bool $case_insensitive = false): function defined(string $constant_name): bool {} -/** @return string|false */ -function get_class(object $object = UNKNOWN) {} +function get_class(object $object = UNKNOWN): string|false {} -/** @return string|false */ -function get_called_class() {} +function get_called_class(): string|false {} -/** @return string|false */ -function get_parent_class($object = UNKNOWN) {} +function get_parent_class($object = UNKNOWN): string|false {} function is_subclass_of($object, string $class_name, bool $allow_string = true): bool {} function is_a($object, string $class_name, bool $allow_string = false): bool {} -/** @return array|false */ -function get_class_vars(string $class_name) {} +function get_class_vars(string $class_name): array|false {} function get_object_vars(object $obj): array {} @@ -103,8 +97,7 @@ function debug_print_backtrace(int $options = 0, int $limit = 0): void {} function extension_loaded(string $extension_name): bool {} -/** @return array|false */ -function get_extension_funcs(string $extension_name) {} +function get_extension_funcs(string $extension_name): array|false {} #if ZEND_DEBUG && defined(ZTS) function zend_thread_id(): int {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index 750b0aa219..bfe5b82a8a 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -10,7 +10,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, arg_num, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_args, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_func_get_args, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strlen, 0, 1, IS_LONG, 0) @@ -22,7 +22,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcmp, 0, 2, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strncmp, 0, 3, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0) @@ -42,13 +42,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_END_ARG_INFO() -#define arginfo_get_called_class arginfo_func_get_args +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_called_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) +ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_get_parent_class, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_parent_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() @@ -60,7 +61,7 @@ ZEND_END_ARG_INFO() #define arginfo_is_a arginfo_is_subclass_of -ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_vars, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class_vars, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -175,7 +176,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extension_loaded, 0, 1, _IS_BOOL ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_get_extension_funcs, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_extension_funcs, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h index 56d4ddeccf..a65d6b1b12 100644 --- a/Zend/zend_generators_arginfo.h +++ b/Zend/zend_generators_arginfo.h @@ -1,13 +1,15 @@ /* This is a generated file, edit the .stub.php file instead. */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_rewind, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0) ZEND_END_ARG_INFO() -#define arginfo_class_Generator_valid arginfo_class_Generator_rewind +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_valid, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_Generator_current arginfo_class_Generator_rewind +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_current, 0, 0, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_Generator_key arginfo_class_Generator_rewind +#define arginfo_class_Generator_key arginfo_class_Generator_current #define arginfo_class_Generator_next arginfo_class_Generator_rewind @@ -19,4 +21,4 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, exception, Throwable, 0) ZEND_END_ARG_INFO() -#define arginfo_class_Generator_getReturn arginfo_class_Generator_rewind +#define arginfo_class_Generator_getReturn arginfo_class_Generator_current diff --git a/ext/bcmath/bcmath.stub.php b/ext/bcmath/bcmath.stub.php index 274759b8a6..5f59487f41 100644 --- a/ext/bcmath/bcmath.stub.php +++ b/ext/bcmath/bcmath.stub.php @@ -10,8 +10,7 @@ function bcdiv(string $dividend, string $divisor, int $scale = UNKNOWN) : string function bcmod(string $dividend, string $divisor, int $scale = UNKNOWN) : string {} -/** @return string|false */ -function bcpowmod(string $base, string $exponent, string $modulus, int $scale = UNKNOWN) {} +function bcpowmod(string $base, string $exponent, string $modulus, int $scale = UNKNOWN): string|false {} function bcpow(string $base, string $exponent, int $scale = UNKNOWN) : string {} diff --git a/ext/bcmath/bcmath_arginfo.h b/ext/bcmath/bcmath_arginfo.h index 2d2117acaa..dd246518dc 100644 --- a/ext/bcmath/bcmath_arginfo.h +++ b/ext/bcmath/bcmath_arginfo.h @@ -18,7 +18,7 @@ ZEND_END_ARG_INFO() #define arginfo_bcmod arginfo_bcdiv -ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bcpowmod, 0, 3, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, modulus, IS_STRING, 0) diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php index f90d66c168..b4898481d0 100644 --- a/ext/bz2/bz2.stub.php +++ b/ext/bz2/bz2.stub.php @@ -6,49 +6,37 @@ */ function bzopen($file, string $mode) {} -/** - * @param resource $bz - * @return string|false - */ -function bzread ($bz, int $length = 1024) {} +/** @param resource $bz */ +function bzread($bz, int $length = 1024): string|false {} -/** - * @param resource $bz - * @return int|false - */ -function bzwrite ($bz, string $str, int $length = UNKNOWN) {} +/** @param resource $bz */ +function bzwrite($bz, string $str, int $length = UNKNOWN): int|false {} /** * @param resource $bz */ -function bzflush ($bz): bool {} +function bzflush($bz): bool {} /** * @param resource $bz */ -function bzclose ($bz): bool {} +function bzclose($bz): bool {} /** * @param resource $bz */ -function bzerrno ($bz): int {} +function bzerrno($bz): int {} /** * @param resource $bz */ -function bzerrstr ($bz): string {} +function bzerrstr($bz): string {} /** * @param resource $bz */ -function bzerror ($bz): array {} +function bzerror($bz): array {} -/** - * @return string|int - */ -function bzcompress (string $source, int $blocksize = 4, int $workfactor = 0) {} +function bzcompress(string $source, int $blocksize = 4, int $workfactor = 0): string|int {} -/** - * @return string|int - */ -function bzdecompress (string $source, int $small = 0) {} +function bzdecompress(string $source, int $small = 0): string|int|false {} diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h index be89a095e8..5010a959a3 100644 --- a/ext/bz2/bz2_arginfo.h +++ b/ext/bz2/bz2_arginfo.h @@ -5,12 +5,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_bzread, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzread, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, bz) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_bzwrite, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_INFO(0, bz) ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0) @@ -34,13 +34,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerror, 0, 1, IS_ARRAY, 0) ZEND_ARG_INFO(0, bz) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzcompress, 0, 1, MAY_BE_STRING|MAY_BE_LONG) ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, blocksize, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, workfactor, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_bzdecompress, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzdecompress, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, small, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/calendar/calendar.stub.php b/ext/calendar/calendar.stub.php index 888986a708..88b5b5fe39 100644 --- a/ext/calendar/calendar.stub.php +++ b/ext/calendar/calendar.stub.php @@ -16,8 +16,7 @@ function frenchtojd(int $month, int $day, int $year): int {} function gregoriantojd(int $month, int $day, int $year): int {} -/** @return int|string */ -function jddayofweek(int $juliandaycount, int $mode = CAL_DOW_DAYNO) {} +function jddayofweek(int $juliandaycount, int $mode = CAL_DOW_DAYNO): int|string {} function jdmonthname(int $juliandaycount, int $mode): string {} @@ -35,5 +34,4 @@ function jewishtojd(int $month, int $day, int $year): int {} function juliantojd(int $month, int $day, int $year): int {} -/** @return int|false */ -function unixtojd(int $timestamp = UNKNOWN) {} +function unixtojd(int $timestamp = UNKNOWN): int|false {} diff --git a/ext/calendar/calendar_arginfo.h b/ext/calendar/calendar_arginfo.h index a03ef6778b..ab0064d016 100644 --- a/ext/calendar/calendar_arginfo.h +++ b/ext/calendar/calendar_arginfo.h @@ -37,7 +37,7 @@ ZEND_END_ARG_INFO() #define arginfo_gregoriantojd arginfo_frenchtojd -ZEND_BEGIN_ARG_INFO_EX(arginfo_jddayofweek, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_jddayofweek, 0, 1, MAY_BE_LONG|MAY_BE_STRING) ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -69,6 +69,6 @@ ZEND_END_ARG_INFO() #define arginfo_juliantojd arginfo_frenchtojd -ZEND_BEGIN_ARG_INFO_EX(arginfo_unixtojd, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unixtojd, 0, 0, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/com_dotnet/com_extension.stub.php b/ext/com_dotnet/com_extension.stub.php index 34ff543297..83cfc50350 100644 --- a/ext/com_dotnet/com_extension.stub.php +++ b/ext/com_dotnet/com_extension.stub.php @@ -55,8 +55,7 @@ function variant_cast(variant $variant, int $type): variant {} function com_get_active_object(string $progid, int $code_page = UNKNOWN): variant {} -/** @return string|false */ -function com_create_guid() {} +function com_create_guid(): string|false {} function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface = UNKNOWN): bool {} diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h index b2f7d0a09c..b8ffef8077 100644 --- a/ext/com_dotnet/com_extension_arginfo.h +++ b/ext/com_dotnet/com_extension_arginfo.h @@ -85,7 +85,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_com_get_active_object, 0, 1, vari ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_com_create_guid, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_com_create_guid, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_event_sink, 0, 2, _IS_BOOL, 0) diff --git a/ext/curl/curl.stub.php b/ext/curl/curl.stub.php index 022438d0b2..4d9f3ad049 100644 --- a/ext/curl/curl.stub.php +++ b/ext/curl/curl.stub.php @@ -5,7 +5,6 @@ function curl_close($handle): void {} /** * @param resource $handle - * * @return resource|false */ function curl_copy_handle($handle) {} @@ -16,19 +15,11 @@ function curl_errno($handle): int {} /** @param resource $handle */ function curl_error($handle): string {} -/** - * @param resource $handle - * - * @return string|false - */ -function curl_escape($handle, string $string) {} +/** @param resource $handle */ +function curl_escape($handle, string $string): string|false {} -/** - * @param resource $handle - * - * @return string|bool - */ -function curl_exec($handle) {} +/** @param resource $handle */ +function curl_exec($handle): string|bool {} function curl_file_create( string $filename, @@ -38,14 +29,12 @@ function curl_file_create( /** * @param resource $handle - * * @return mixed */ function curl_getinfo($handle, int $option = UNKNOWN) {} /** * @param resource $handle - * * @return resource|false */ function curl_init(string $url = UNKNOWN) {} @@ -59,11 +48,7 @@ function curl_multi_add_handle($multi_handle, $handle): int {} /** @param resource $multi_handle */ function curl_multi_close($multi_handle): void {} -/** - * @param resource $multi_handle - * - * @return int|false - */ +/** @param resource $multi_handle */ function curl_multi_errno($multi_handle): int {} /** @param resource $multi_handle */ @@ -72,12 +57,8 @@ function curl_multi_exec($multi_handle, &$still_running): int {} /** @param resource $multi_handle */ function curl_multi_getcontent($multi_handle): ?string {} -/** - * @param resource $multi_handle - * - * @return array|false - */ -function curl_multi_info_read($multi_handle, &$msgs_in_queue = null) {} +/** @param resource $multi_handle */ +function curl_multi_info_read($multi_handle, &$msgs_in_queue = null): array|false {} /** @return resource */ function curl_multi_init() {} @@ -136,12 +117,7 @@ function curl_share_strerror(int $error_number): ?string {} function curl_strerror(int $error_number): ?string {} -/** - * @param resource $handle - * - * @return string|false - */ -function curl_unescape($handle, string $string) {} +/** @param resource $handle */ +function curl_unescape($handle, string $string): string|false {} -/** @return array|false */ -function curl_version(int $age = UNKNOWN) {} +function curl_version(int $age = UNKNOWN): array|false {} diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h index 561c0a7684..a7ae7a071b 100644 --- a/ext/curl/curl_arginfo.h +++ b/ext/curl/curl_arginfo.h @@ -16,12 +16,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_error, 0, 1, IS_STRING, 0) ZEND_ARG_INFO(0, handle) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_escape, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_escape, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, handle) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_curl_exec arginfo_curl_copy_handle +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL) + ZEND_ARG_INFO(0, handle) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_curl_file_create, 0, 1, CURLFile, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) @@ -60,7 +62,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_getcontent, 0, 1, IS_ ZEND_ARG_INFO(0, multi_handle) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_info_read, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_multi_info_read, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_INFO(0, multi_handle) ZEND_ARG_INFO(1, msgs_in_queue) ZEND_END_ARG_INFO() @@ -127,6 +129,6 @@ ZEND_END_ARG_INFO() #define arginfo_curl_unescape arginfo_curl_escape -ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_version, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_version, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, age, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index 840efd19c7..13d301ee9f 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -3,33 +3,27 @@ /* TODO: Convert "uninitialized" into an exception. This will remove many * possibilities for false return values in here. */ -/** @return int|false */ -function strtotime(string $time, int $now = UNKNOWN) {} +function strtotime(string $time, int $now = UNKNOWN): int|false {} function date(string $format, int $timestamp = UNKNOWN): string {} -/** @return int|false */ -function idate(string $format, int $timestamp = UNKNOWN) {} +function idate(string $format, int $timestamp = UNKNOWN): int|false {} function gmdate(string $format, int $timestamp = UNKNOWN): string {} -/** @return int|false */ function mktime( int $hour, int $min = UNKNOWN, int $sec = UNKNOWN, - int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN) {} + int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN): int|false {} -/** @return int|false */ function gmmktime( int $hour, int $min = UNKNOWN, int $sec = UNKNOWN, - int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN) {} + int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN): int|false {} function checkdate(int $m, int $d, int $y): bool {} -/** @return string|false */ -function strftime(string $format, int $timestamp = UNKNOWN) {} +function strftime(string $format, int $timestamp = UNKNOWN): string|false {} -/** @return string|false */ -function gmstrftime(string $format, int $timestamp = UNKNOWN) {} +function gmstrftime(string $format, int $timestamp = UNKNOWN): string|false {} function time(): int {} @@ -54,8 +48,7 @@ function date_parse(string $date): array {} function date_parse_from_format(string $format, string $date): array {} -/** @return array|false */ -function date_get_last_errors() {} +function date_get_last_errors(): array|false {} function date_format(DateTimeInterface $object, string $format): string {} @@ -85,28 +78,23 @@ function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1): function date_timestamp_set(DateTime $object, int $timestamp): DateTime {} -/** @return int|false */ -function date_timestamp_get(DateTimeInterface $object) {} +function date_timestamp_get(DateTimeInterface $object): int|false {} /** @return DateTimeZone|false */ function timezone_open(string $timezone) {} function timezone_name_get(DateTimeZone $object): string {} -/** @return string|false */ -function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst = -1) {} +function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst = -1): string|false {} function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {} -/** @return array|false */ function timezone_transitions_get( - DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) {} + DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX): array|false {} -/** @return array|false */ -function timezone_location_get(DateTimeZone $object) {} +function timezone_location_get(DateTimeZone $object): array|false {} -/** @return array|false */ -function timezone_identifiers_list(int $what = DateTimeZone::ALL, ?string $country = null) {} +function timezone_identifiers_list(int $what = DateTimeZone::ALL, ?string $country = null): array|false {} function timezone_abbreviations_list(): array {} @@ -121,17 +109,15 @@ function date_default_timezone_set(string $timezone_identifier): bool {} function date_default_timezone_get(): string {} -/** @return string|int|float|false */ function date_sunrise( int $time, int $retformat = SUNFUNCS_RET_STRING, float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN, - float $gmt_offset = 0) {} + float $gmt_offset = 0): string|int|float|false {} -/** @return string|int|float|false */ function date_sunset( int $time, int $retformat = SUNFUNCS_RET_STRING, float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN, - float $gmt_offset = 0) {} + float $gmt_offset = 0): string|int|float|false {} function date_sun_info(int $time, float $latitude, float $longitude): array {} diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index 57832f005e..7f8edb79e9 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,6 +1,6 @@ /* This is a generated file, edit the .stub.php file instead. */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, now, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -10,14 +10,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_idate, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idate, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) ZEND_END_ARG_INFO() #define arginfo_gmdate arginfo_date -ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mktime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, sec, IS_LONG, 0) @@ -34,9 +34,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_checkdate, 0, 3, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_strftime arginfo_idate +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strftime, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) +ZEND_END_ARG_INFO() -#define arginfo_gmstrftime arginfo_idate +#define arginfo_gmstrftime arginfo_strftime ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_time, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -74,7 +77,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse_from_format, 0, 2, IS ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_get_last_errors, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_get_last_errors, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_format, 0, 2, IS_STRING, 0) @@ -140,7 +143,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTim ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_date_timestamp_get arginfo_date_timezone_get +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_timestamp_get, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0) @@ -150,7 +155,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_name_get, 0, 1, IS_STRI ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_name_from_abbr, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, abbr, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, gmtoffset, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, isdst, IS_LONG, 0) @@ -161,17 +166,17 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_offset_get, 0, 2, IS_LO ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_transitions_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) ZEND_ARG_TYPE_INFO(0, timestamp_begin, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_location_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_identifiers_list, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, country, IS_STRING, 1) ZEND_END_ARG_INFO() @@ -197,7 +202,7 @@ ZEND_END_ARG_INFO() #define arginfo_date_default_timezone_get arginfo_timezone_version_get -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunrise, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_sunrise, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, retformat, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0) @@ -218,18 +223,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_format, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_class_DateTimeInterface_getTimezone arginfo_date_get_last_errors +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_getTimezone, 0, 0, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_DateTimeInterface_getOffset arginfo_date_get_last_errors +#define arginfo_class_DateTimeInterface_getOffset arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DateTimeInterface_getTimestamp arginfo_date_get_last_errors +#define arginfo_class_DateTimeInterface_getTimestamp arginfo_class_DateTimeInterface_getTimezone ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_diff, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) ZEND_ARG_TYPE_INFO(0, absolute, _IS_BOOL, 0) ZEND_END_ARG_INFO() -#define arginfo_class_DateTimeInterface___wakeup arginfo_date_get_last_errors +#define arginfo_class_DateTimeInterface___wakeup arginfo_class_DateTimeInterface_getTimezone #define arginfo_class_DateTime___construct arginfo_date_create @@ -243,7 +249,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_DateTime_createFromFormat arginfo_date_create_from_format -#define arginfo_class_DateTime_getLastErrors arginfo_date_get_last_errors +#define arginfo_class_DateTime_getLastErrors arginfo_class_DateTimeInterface_getTimezone ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_modify, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0) @@ -308,7 +314,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_DateTimeZone___construct arginfo_timezone_open -#define arginfo_class_DateTimeZone_getName arginfo_date_get_last_errors +#define arginfo_class_DateTimeZone_getName arginfo_class_DateTimeInterface_getTimezone ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1) ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) @@ -319,13 +325,16 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0) ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_class_DateTimeZone_getLocation arginfo_date_get_last_errors +#define arginfo_class_DateTimeZone_getLocation arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DateTimeZone_listAbbreviations arginfo_date_get_last_errors +#define arginfo_class_DateTimeZone_listAbbreviations arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DateTimeZone_listIdentifiers arginfo_timezone_identifiers_list +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_listIdentifiers, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, country, IS_STRING, 1) +ZEND_END_ARG_INFO() -#define arginfo_class_DateTimeZone___wakeup arginfo_date_get_last_errors +#define arginfo_class_DateTimeZone___wakeup arginfo_class_DateTimeInterface_getTimezone #define arginfo_class_DateTimeZone___set_state arginfo_class_DateTime___set_state @@ -337,7 +346,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_DateInterval_format arginfo_class_DateTimeInterface_format -#define arginfo_class_DateInterval___wakeup arginfo_date_get_last_errors +#define arginfo_class_DateInterval___wakeup arginfo_class_DateTimeInterface_getTimezone #define arginfo_class_DateInterval___set_state arginfo_class_DateTime___set_state @@ -347,14 +356,14 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DatePeriod___construct, 0, 0, 1) ZEND_ARG_INFO(0, end) ZEND_END_ARG_INFO() -#define arginfo_class_DatePeriod_getStartDate arginfo_date_get_last_errors +#define arginfo_class_DatePeriod_getStartDate arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DatePeriod_getEndDate arginfo_date_get_last_errors +#define arginfo_class_DatePeriod_getEndDate arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DatePeriod_getDateInterval arginfo_date_get_last_errors +#define arginfo_class_DatePeriod_getDateInterval arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DatePeriod_getRecurrences arginfo_date_get_last_errors +#define arginfo_class_DatePeriod_getRecurrences arginfo_class_DateTimeInterface_getTimezone -#define arginfo_class_DatePeriod___wakeup arginfo_date_get_last_errors +#define arginfo_class_DatePeriod___wakeup arginfo_class_DateTimeInterface_getTimezone #define arginfo_class_DatePeriod___set_state arginfo_class_DateTime___set_state diff --git a/ext/dba/dba.stub.php b/ext/dba/dba.stub.php index 80b82259fc..96ce6d573a 100644 --- a/ext/dba/dba.stub.php +++ b/ext/dba/dba.stub.php @@ -19,24 +19,16 @@ function dba_exists($key, $handle): bool {} * @param string|array $key * @param int|resource $skip actually this parameter is optional, not $handle * @param resource $handle - * @return string|false */ -function dba_fetch($key, $skip, $handle = UNKOWN) {} +function dba_fetch($key, $skip, $handle = UNKOWN): string|false {} -/** @return array|false */ -function dba_key_split(string $key) {} +function dba_key_split(string $key): array|false {} -/** - * @param resource $handle - * @return string|false - */ -function dba_firstkey($handle) {} +/** @param resource $handle */ +function dba_firstkey($handle): string|false {} -/** - * @param resource $handle - * @return string|false - */ -function dba_nextkey($handle) {} +/** @param resource $handle */ +function dba_nextkey($handle): string|false {} /** * @param string|array $key diff --git a/ext/dba/dba_arginfo.h b/ext/dba/dba_arginfo.h index d5ac0683f8..32e925fb6a 100644 --- a/ext/dba/dba_arginfo.h +++ b/ext/dba/dba_arginfo.h @@ -18,17 +18,17 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_exists, 0, 2, _IS_BOOL, 0) ZEND_ARG_INFO(0, handle) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_fetch, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_fetch, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, key) ZEND_ARG_INFO(0, skip) ZEND_ARG_INFO(0, handle) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_key_split, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_key_split, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_firstkey, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_firstkey, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, handle) ZEND_END_ARG_INFO() diff --git a/ext/enchant/enchant.stub.php b/ext/enchant/enchant.stub.php index 71f0e81715..22533b9b82 100644 --- a/ext/enchant/enchant.stub.php +++ b/ext/enchant/enchant.stub.php @@ -15,11 +15,8 @@ function enchant_broker_get_error($broker) {} /** @param resource $broker */ function enchant_broker_set_dict_path($broker, int $name, string $value): bool {} -/** - * @param resource $broker - * @return string|false - */ -function enchant_broker_get_dict_path($broker, int $name) {} +/** @param resource $broker */ +function enchant_broker_get_dict_path($broker, int $name): string|false {} /** @param resource $broker */ function enchant_broker_list_dicts($broker): array {} @@ -69,11 +66,8 @@ function enchant_dict_is_in_session($dict, string $word): bool {} /** @param resource $dict */ function enchant_dict_store_replacement($dict, string $mis, string $cor): void {} -/** -* @param resource $dict -* @return string|false -*/ -function enchant_dict_get_error($dict) {} +/** @param resource $dict */ +function enchant_dict_get_error($dict): string|false {} /** @param resource $dict */ function enchant_dict_describe($dict): array {} diff --git a/ext/enchant/enchant_arginfo.h b/ext/enchant/enchant_arginfo.h index 488567651c..dae661d197 100644 --- a/ext/enchant/enchant_arginfo.h +++ b/ext/enchant/enchant_arginfo.h @@ -17,7 +17,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_dict_path, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_broker_get_dict_path, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, broker) ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -84,7 +84,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_store_replacement, ZEND_ARG_TYPE_INFO(0, cor, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_get_error, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_dict_get_error, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_INFO(0, dict) ZEND_END_ARG_INFO() diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php index a878c3c3ff..3fe2e72f66 100644 --- a/ext/exif/exif.stub.php +++ b/ext/exif/exif.stub.php @@ -1,13 +1,9 @@ = 52 -/** @return string|false */ -function intltz_get_windows_id(string $timezone) {} +function intltz_get_windows_id(string $timezone): string|false {} -/** @return string|false */ -function intltz_get_id_for_windows_id(string $timezone, string $region = UNKNOWN) {} +function intltz_get_id_for_windows_id(string $timezone, string $region = UNKNOWN): string|false {} #endif function intltz_has_same_rules(IntlTimeZone $tz, IntlTimeZone $otherTimeZone): bool {} diff --git a/ext/intl/timezone/timezone_arginfo.h b/ext/intl/timezone/timezone_arginfo.h index 48d99f5ee9..72a3c964c6 100644 --- a/ext/intl/timezone/timezone_arginfo.h +++ b/ext/intl/timezone/timezone_arginfo.h @@ -87,7 +87,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_IntlTimeZone_useDaylightTime arginfo_class_IntlTimeZone___construct -#define arginfo_intltz_count_equivalent_ids arginfo_class_IntlTimeZone_countEquivalentIDs +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_count_equivalent_ids, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_create_default, 0, 0, IntlTimeZone, 0) ZEND_END_ARG_INFO() @@ -104,28 +106,36 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_from_date_time_zone, 0, 1, ZEND_ARG_OBJ_INFO(0, zone, DateTimeZone, 0) ZEND_END_ARG_INFO() -#define arginfo_intltz_get_canonical_id arginfo_class_IntlTimeZone_getCanonicalID +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_canonical_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0) + ZEND_ARG_INFO(1, isSystemID) +ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_intltz_get_display_name, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_display_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) ZEND_ARG_TYPE_INFO(0, isDaylight, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_intltz_get_dst_savings, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_dst_savings, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) ZEND_END_ARG_INFO() -#define arginfo_intltz_get_equivalent_id arginfo_class_IntlTimeZone_getEquivalentID +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_equivalent_id, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) +ZEND_END_ARG_INFO() #define arginfo_intltz_get_error_code arginfo_intltz_get_dst_savings -#define arginfo_intltz_get_error_message arginfo_intltz_get_dst_savings +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) +ZEND_END_ARG_INFO() #define arginfo_intltz_get_gmt arginfo_intltz_create_default -#define arginfo_intltz_get_id arginfo_intltz_get_dst_savings +#define arginfo_intltz_get_id arginfo_intltz_get_error_message ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_get_offset, 0, 5, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) @@ -137,18 +147,26 @@ ZEND_END_ARG_INFO() #define arginfo_intltz_get_raw_offset arginfo_intltz_get_dst_savings -#define arginfo_intltz_get_region arginfo_class_IntlTimeZone_countEquivalentIDs +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_region, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0) +ZEND_END_ARG_INFO() -#define arginfo_intltz_get_tz_data_version arginfo_class_IntlTimeZone___construct +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_tz_data_version, 0, 0, MAY_BE_STRING|MAY_BE_FALSE) +ZEND_END_ARG_INFO() #define arginfo_intltz_get_unknown arginfo_intltz_create_default #if U_ICU_VERSION_MAJOR_NUM >= 52 -#define arginfo_intltz_get_windows_id arginfo_class_IntlTimeZone_getWindowsID +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_windows_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0) +ZEND_END_ARG_INFO() #endif #if U_ICU_VERSION_MAJOR_NUM >= 52 -#define arginfo_intltz_get_id_for_windows_id arginfo_class_IntlTimeZone_getIDForWindowsID +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_id_for_windows_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, region, IS_STRING, 0) +ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_has_same_rules, 0, 2, _IS_BOOL, 0) @@ -156,7 +174,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_has_same_rules, 0, 2, _IS ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0) ZEND_END_ARG_INFO() -#define arginfo_intltz_to_date_time_zone arginfo_intltz_get_dst_savings +ZEND_BEGIN_ARG_INFO_EX(arginfo_intltz_to_date_time_zone, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_use_daylight_time, 0, 1, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0) diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php index 6b00648461..90bedef91e 100644 --- a/ext/json/json.stub.php +++ b/ext/json/json.stub.php @@ -1,7 +1,6 @@ extension #%d pcre version %s ] { Parameter #3 [ int $flags ] Parameter #4 [ int $offset ] } + - Return [ int|false ] } Function [ function preg_match_all ] { @@ -84,6 +85,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #3 [ int $flags ] Parameter #4 [ int $offset ] } + - Return [ int|false|null ] } Function [ function preg_replace ] { @@ -94,6 +96,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #3 [ int $limit ] Parameter #4 [ &$count ] } + - Return [ array|string|null ] } Function [ function preg_replace_callback ] { @@ -105,6 +108,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #4 [ &$count ] Parameter #5 [ int $flags ] } + - Return [ array|string|null ] } Function [ function preg_replace_callback_array ] { @@ -115,6 +119,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #3 [ &$count ] Parameter #4 [ int $flags ] } + - Return [ array|string|null ] } Function [ function preg_filter ] { @@ -125,6 +130,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #3 [ int $limit ] Parameter #4 [ &$count ] } + - Return [ array|string|null ] } Function [ function preg_split ] { @@ -134,6 +140,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #2 [ int $limit ] Parameter #3 [ int $flags ] } + - Return [ array|false ] } Function [ function preg_quote ] { @@ -150,6 +157,7 @@ string(%d) "Extension [ extension #%d pcre version %s ] { Parameter #1 [ array $input ] Parameter #2 [ int $flags ] } + - Return [ array|false ] } Function [ function preg_last_error ] { diff --git a/sapi/phpdbg/phpdbg.stub.php b/sapi/phpdbg/phpdbg.stub.php index cf6575de20..bcccc5f9d0 100644 --- a/sapi/phpdbg/phpdbg.stub.php +++ b/sapi/phpdbg/phpdbg.stub.php @@ -12,8 +12,7 @@ function phpdbg_color(int $element, string $color): void {} function phpdbg_prompt(string $string): void {} -/** @return string|bool */ -function phpdbg_exec(string $context) {} +function phpdbg_exec(string $context): string|bool {} function phpdbg_clear(): void {} diff --git a/sapi/phpdbg/phpdbg_arginfo.h b/sapi/phpdbg/phpdbg_arginfo.h index c59f6ecf0f..e130ebd33f 100644 --- a/sapi/phpdbg/phpdbg_arginfo.h +++ b/sapi/phpdbg/phpdbg_arginfo.h @@ -26,7 +26,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_prompt, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_phpdbg_exec, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpdbg_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php index 2aed71af61..a02e23b256 100755 --- a/scripts/dev/gen_stub.php +++ b/scripts/dev/gen_stub.php @@ -108,6 +108,8 @@ class SimpleType { public function toTypeMask() { assert($this->isBuiltin); switch (strtolower($this->name)) { + case "null": + return "MAY_BE_NULL"; case "false": return "MAY_BE_FALSE"; case "bool": -- cgit v1.2.1