From 4a7a41473503a1b66b7bec13f07e96f26d290c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Tue, 24 Aug 2021 19:19:35 +0200 Subject: [PATCH] Fix callable and iterable handling --- Zend/Optimizer/zend_func_infos.h | 1 + Zend/zend_builtin_functions.stub.php | 4 ++-- Zend/zend_builtin_functions_arginfo.h | 2 +- build/gen_stub.php | 26 ++++++++++++++++---------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index b7083224ec2..9da5a7bebc4 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -61,4 +61,5 @@ static const func_info_t func_infos[] = { FN("oci_password_change", MAY_BE_RESOURCE|MAY_BE_BOOL), FN("oci_new_cursor", MAY_BE_RESOURCE|MAY_BE_FALSE), F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE), + FN("pcntl_signal_get_handler", MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT|MAY_BE_LONG), }; diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index b7d5d9583f9..0a169f064cc 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -91,13 +91,13 @@ function trigger_error(string $message, int $error_level = E_USER_NOTICE): bool /** @alias trigger_error */ function user_error(string $message, int $error_level = E_USER_NOTICE): bool {} -/** @return string|array|object|null */ +/** @return callable|null */ function set_error_handler(?callable $callback, int $error_levels = E_ALL) {} /** @return true */ function restore_error_handler(): bool {} -/** @return string|array|object|null */ +/** @return callable|null */ function set_exception_handler(?callable $callback) {} /** @return true */ diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index adf70ce98ea..6bd7a1f95f5 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: cf84a097dab1a043133faf0b03f002748b3c8eda */ + * Stub hash: 830eee0780adba8fc87cd5aed7f755d4d85ed82b */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/build/gen_stub.php b/build/gen_stub.php index 213e88d3cfd..1ef55c972f7 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -192,6 +192,7 @@ class SimpleType { case "int": case "float": case "string": + case "callable": case "iterable": case "object": case "resource": @@ -297,8 +298,12 @@ class SimpleType { return "MAY_BE_OBJECT"; case "callable": return "MAY_BE_CALLABLE"; + case "iterable": + return "MAY_BE_ITERABLE"; case "mixed": return "MAY_BE_ANY"; + case "void": + return "MAY_BE_VOID"; case "static": return "MAY_BE_STATIC"; case "never": @@ -357,16 +362,17 @@ class SimpleType { return "MAY_BE_OBJECT"; } - if ($this->name === "resource") { - return "MAY_BE_RESOURCE"; - } - - if ($this->name === "true") { - return "MAY_BE_TRUE"; - } - - if ($this->name === "mixed") { - return "MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY"; + switch ($this->name) { + case "true": + return "MAY_BE_TRUE"; + case "resource": + return "MAY_BE_RESOURCE"; + case "callable": + return "MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_OBJECT"; + case "iterable": + return "MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_OBJECT"; + case "mixed": + return "MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY"; } return $this->toTypeMask();