diff options
author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-05-25 17:30:49 +0200 |
---|---|---|
committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-05-25 17:30:57 +0200 |
commit | b3718430de781647676b5ec2b2b004c310e25e4b (patch) | |
tree | 0725481b1f272fca750fd6ac00546c68ce030375 | |
parent | cbf86efc218e203ec692941aab8ab8077ab63f1b (diff) | |
download | php-git-b3718430de781647676b5ec2b2b004c310e25e4b.tar.gz |
Annotate internal functions with the mixed type
Closes GH-5618
-rw-r--r-- | Zend/zend_builtin_functions.stub.php | 7 | ||||
-rw-r--r-- | Zend/zend_builtin_functions_arginfo.h | 2 | ||||
-rw-r--r-- | Zend/zend_closures.stub.php | 3 | ||||
-rw-r--r-- | Zend/zend_closures_arginfo.h | 4 | ||||
-rw-r--r-- | Zend/zend_generators.stub.php | 15 | ||||
-rw-r--r-- | Zend/zend_generators_arginfo.h | 8 | ||||
-rwxr-xr-x | build/gen_stub.php | 15 | ||||
-rw-r--r-- | ext/filter/filter.stub.php | 35 | ||||
-rw-r--r-- | ext/filter/filter_arginfo.h | 10 | ||||
-rw-r--r-- | ext/json/json.stub.php | 5 | ||||
-rw-r--r-- | ext/json/json_arginfo.h | 4 | ||||
-rw-r--r-- | ext/mysqli/mysqli.stub.php | 5 | ||||
-rw-r--r-- | ext/mysqli/mysqli_arginfo.h | 4 | ||||
-rw-r--r-- | ext/opcache/Optimizer/zend_func_info.c | 2 | ||||
-rw-r--r-- | ext/pdo/pdo_dbh.stub.php | 2 | ||||
-rw-r--r-- | ext/reflection/php_reflection.stub.php | 4 | ||||
-rw-r--r-- | ext/reflection/php_reflection_arginfo.h | 8 | ||||
-rwxr-xr-x | ext/standard/basic_functions.stub.php | 221 | ||||
-rwxr-xr-x | ext/standard/basic_functions_arginfo.h | 70 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc.stub.php | 15 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc_arginfo.h | 10 | ||||
-rw-r--r-- | ext/zend_test/test.stub.php | 3 | ||||
-rw-r--r-- | ext/zend_test/test_arginfo.h | 2 |
23 files changed, 181 insertions, 273 deletions
diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index 9dfaf64ca5..9e5078f14a 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -6,8 +6,7 @@ function zend_version(): string {} function func_num_args(): int {} -/** @return mixed */ -function func_get_arg(int $arg_num) {} +function func_get_arg(int $arg_num): mixed {} function func_get_args(): array {} @@ -69,12 +68,12 @@ function trigger_error(string $message, int $error_type = E_USER_NOTICE): bool { /** @alias trigger_error */ function user_error(string $message, int $error_type = E_USER_NOTICE): bool {} -/** @return mixed */ +/** @return string|array|object|null */ function set_error_handler($error_handler, int $error_types = E_ALL) {} function restore_error_handler(): bool {} -/** @return mixed */ +/** @return string|array|object|null */ function set_exception_handler($exception_handler) {} function restore_exception_handler(): bool {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index 728a76cdee..0fa4ba7f45 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -6,7 +6,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_func_num_args, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_func_get_arg, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, arg_num, IS_LONG, 0) ZEND_END_ARG_INFO() diff --git a/Zend/zend_closures.stub.php b/Zend/zend_closures.stub.php index 75202c5df7..9cc298eee0 100644 --- a/Zend/zend_closures.stub.php +++ b/Zend/zend_closures.stub.php @@ -11,8 +11,7 @@ final class Closure /** @alias Closure::bind */ public function bindTo(?object $newthis, $newscope = UNKNOWN): ?Closure {} - /** @return mixed */ - public function call(object $newthis, ...$parameters) {} + public function call(object $newthis, mixed ...$parameters): mixed {} /** @param callable $callable Not a proper type annotation due to bug #78770 */ public static function fromCallable($callable): Closure {} diff --git a/Zend/zend_closures_arginfo.h b/Zend/zend_closures_arginfo.h index a1eddd7bc1..85802bbfb4 100644 --- a/Zend/zend_closures_arginfo.h +++ b/Zend/zend_closures_arginfo.h @@ -14,9 +14,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Closure_bindTo, 0, 1, Closu ZEND_ARG_INFO(0, newscope) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_call, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Closure_call, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 0) - ZEND_ARG_VARIADIC_INFO(0, parameters) + ZEND_ARG_VARIADIC_TYPE_INFO(0, parameters, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Closure_fromCallable, 0, 1, Closure, 0) diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php index 5fb485895c..f2e47616ba 100644 --- a/Zend/zend_generators.stub.php +++ b/Zend/zend_generators.stub.php @@ -8,20 +8,15 @@ final class Generator implements Iterator public function valid(): bool {} - /** @return mixed */ - public function current() {} + public function current(): mixed {} - /** @return mixed */ - public function key() {} + public function key(): mixed {} public function next(): void {} - /** @return mixed */ - public function send($value) {} + public function send(mixed $value): mixed {} - /** @return mixed */ - public function throw(Throwable $exception) {} + public function throw(Throwable $exception): mixed {} - /** @return mixed */ - public function getReturn() {} + public function getReturn(): mixed {} } diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h index 214595e580..c87ef2c937 100644 --- a/Zend/zend_generators_arginfo.h +++ b/Zend/zend_generators_arginfo.h @@ -6,18 +6,18 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_valid, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_current, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_current, 0, 0, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_class_Generator_key arginfo_class_Generator_current #define arginfo_class_Generator_next arginfo_class_Generator_rewind -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_send, 0, 0, 1) - ZEND_ARG_INFO(0, value) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_send, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_throw, 0, 1, IS_MIXED, 0) ZEND_ARG_OBJ_INFO(0, exception, Throwable, 0) ZEND_END_ARG_INFO() diff --git a/build/gen_stub.php b/build/gen_stub.php index 4846452219..eb00b34136 100755 --- a/build/gen_stub.php +++ b/build/gen_stub.php @@ -65,6 +65,10 @@ class SimpleType { public static function fromNode(Node $node) { if ($node instanceof Node\Name) { + if ($node->toString() === "mixed") { + return new SimpleType($node->toString(), true); + } + assert($node->isFullyQualified()); return new SimpleType($node->toString(), false); } @@ -97,6 +101,8 @@ class SimpleType { return "IS_VOID"; case "callable": return "IS_CALLABLE"; + case "mixed": + return "IS_MIXED"; default: throw new Exception("Not implemented: $this->name"); } @@ -123,6 +129,8 @@ class SimpleType { return "MAY_BE_OBJECT"; case "callable": return "MAY_BE_CALLABLE"; + case "mixed": + return "MAY_BE_ANY"; default: throw new Exception("Not implemented: $this->name"); } @@ -637,8 +645,11 @@ function parseFunctionLike( $param->default->name->toLowerString() === "null" && $type && !$type->isNullable() ) { - throw new Exception( - "Parameter $varName of function $name has null default, but is not nullable"); + $simpleType = $type->tryToSimpleType(); + if ($simpleType === null || $simpleType->name !== "mixed") { + throw new Exception( + "Parameter $varName of function $name has null default, but is not nullable"); + } } $foundVariadic = $param->variadic; diff --git a/ext/filter/filter.stub.php b/ext/filter/filter.stub.php index 0923b9ba16..e8e6b0fbdd 100644 --- a/ext/filter/filter.stub.php +++ b/ext/filter/filter.stub.php @@ -4,30 +4,17 @@ function filter_has_var(int $type, string $variable_name): bool {} -/** - * @param mixed $options - * @return mixed - */ -function filter_input(int $type, string $variable_name, int $filter = FILTER_DEFAULT, $options = null) {} - -/** - * @param mixed $variable - * @param mixed $options - * @return mixed - */ -function filter_var($variable, int $filter = FILTER_DEFAULT, $options = null) {} - -/** - * @param mixed $options - * @return mixed - */ -function filter_input_array(int $type, $options = FILTER_DEFAULT, bool $add_empty = true) {} - -/** - * @param mixed $options - * @return mixed - */ -function filter_var_array(array $data, $options = FILTER_DEFAULT, bool $add_empty = true) {} +/** @param array|int $options */ +function filter_input(int $type, string $variable_name, int $filter = FILTER_DEFAULT, $options = null): mixed {} + +/** @param array|int $options */ +function filter_var(mixed $variable, int $filter = FILTER_DEFAULT, $options = null): mixed {} + +/** @param array|int $options */ +function filter_input_array(int $type, $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {} + +/** @param array|int $options */ +function filter_var_array(array $data, $options = FILTER_DEFAULT, bool $add_empty = true): array|false|null {} function filter_list(): array {} diff --git a/ext/filter/filter_arginfo.h b/ext/filter/filter_arginfo.h index 8e2e2763cd..bf615fc847 100644 --- a/ext/filter/filter_arginfo.h +++ b/ext/filter/filter_arginfo.h @@ -5,26 +5,26 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_input, 0, 2, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filter, IS_LONG, 0, "FILTER_DEFAULT") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1) - ZEND_ARG_INFO(0, variable) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_var, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, variable, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filter, IS_LONG, 0, "FILTER_DEFAULT") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_filter_input_array, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL) ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "FILTER_DEFAULT") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, add_empty, _IS_BOOL, 0, "true") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_filter_var_array, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "FILTER_DEFAULT") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, add_empty, _IS_BOOL, 0, "true") diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php index 406bd8a87c..fc7d2c1569 100644 --- a/ext/json/json.stub.php +++ b/ext/json/json.stub.php @@ -2,10 +2,9 @@ /** @generate-function-entries */ -function json_encode($value, int $options = 0, int $depth = 512): string|false {} +function json_encode(mixed $value, int $options = 0, int $depth = 512): string|false {} -/** @return mixed */ -function json_decode(string $json, ?bool $assoc = null, int $depth = 512, int $options = 0) {} +function json_decode(string $json, ?bool $assoc = null, int $depth = 512, int $options = 0): mixed {} function json_last_error(): int {} diff --git a/ext/json/json_arginfo.h b/ext/json/json_arginfo.h index 3cc3bbbba8..9514abf19f 100644 --- a/ext/json/json_arginfo.h +++ b/ext/json/json_arginfo.h @@ -1,12 +1,12 @@ /* This is a generated file, edit the .stub.php file instead. */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_json_encode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, depth, IS_LONG, 0, "512") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_json_decode, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, json, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, assoc, _IS_BOOL, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, depth, IS_LONG, 0, "512") diff --git a/ext/mysqli/mysqli.stub.php b/ext/mysqli/mysqli.stub.php index fe581a3723..786796b892 100644 --- a/ext/mysqli/mysqli.stub.php +++ b/ext/mysqli/mysqli.stub.php @@ -407,7 +407,7 @@ class mysqli_stmt * @return bool * @alias mysqli_stmt_bind_param */ - public function bind_param(string $types, &...$vars) {} + public function bind_param(string $types, mixed &...$vars) {} /** * @return bool @@ -681,8 +681,7 @@ function mysqli_stmt_attr_get(mysqli_stmt $mysql_stmt, int $attr): int|false {} function mysqli_stmt_attr_set(mysqli_stmt $mysql_stmt, int $attr, int $mode_in): bool {} -/** @param mixed &...$vars */ -function mysqli_stmt_bind_param(mysqli_stmt $mysql_stmt, string $types, &...$vars): bool {} +function mysqli_stmt_bind_param(mysqli_stmt $mysql_stmt, string $types, mixed &...$vars): bool {} /** @param mixed &...$vars */ function mysqli_stmt_bind_result(mysqli_stmt $mysql_stmt, &...$vars): bool {} diff --git a/ext/mysqli/mysqli_arginfo.h b/ext/mysqli/mysqli_arginfo.h index f42ce8611f..7145ed5624 100644 --- a/ext/mysqli/mysqli_arginfo.h +++ b/ext/mysqli/mysqli_arginfo.h @@ -298,7 +298,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_stmt_bind_param, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, mysql_stmt, mysqli_stmt, 0) ZEND_ARG_TYPE_INFO(0, types, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(1, vars) + ZEND_ARG_VARIADIC_TYPE_INFO(1, vars, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mysqli_stmt_bind_result, 0, 1, _IS_BOOL, 0) @@ -633,7 +633,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_stmt_bind_param, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, types, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(1, vars) + ZEND_ARG_VARIADIC_TYPE_INFO(1, vars, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_stmt_bind_result, 0, 0, 0) diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c index ff29cce989..6d77938025 100644 --- a/ext/opcache/Optimizer/zend_func_info.c +++ b/ext/opcache/Optimizer/zend_func_info.c @@ -214,7 +214,7 @@ static const func_info_t func_infos[] = { F1("password_get_info", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY), F1("convert_uuencode", MAY_BE_FALSE | MAY_BE_STRING), F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING), - F1("pow", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT), + F1("pow", MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT), F1("decbin", MAY_BE_STRING), F1("decoct", MAY_BE_STRING), F1("dechex", MAY_BE_STRING), diff --git a/ext/pdo/pdo_dbh.stub.php b/ext/pdo/pdo_dbh.stub.php index e0ecf122ff..dec3cea0ea 100644 --- a/ext/pdo/pdo_dbh.stub.php +++ b/ext/pdo/pdo_dbh.stub.php @@ -21,7 +21,7 @@ class PDO /** @return int|false */ public function exec(string $statement) {} - /** @return mixed */ + /** @return bool|int|string|array|null */ public function getAttribute(int $attribute) {} /** @return array */ diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php index e629b8d845..3062747507 100644 --- a/ext/reflection/php_reflection.stub.php +++ b/ext/reflection/php_reflection.stub.php @@ -111,7 +111,7 @@ class ReflectionFunction extends ReflectionFunctionAbstract public function isDisabled() {} /** @return mixed */ - public function invoke(...$args) {} + public function invoke(mixed ...$args) {} /** @return mixed */ public function invokeArgs(array $args) {} @@ -181,7 +181,7 @@ class ReflectionMethod extends ReflectionFunctionAbstract public function getModifiers() {} /** @return mixed */ - public function invoke(?object $object = null, ...$args) {} + public function invoke(?object $object = null, mixed ...$args) {} /** @return mixed */ public function invokeArgs(?object $object, array $args) {} diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h index 91e9c4cada..1e3e9988de 100644 --- a/ext/reflection/php_reflection_arginfo.h +++ b/ext/reflection/php_reflection_arginfo.h @@ -67,7 +67,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_ReflectionFunction_isDisabled arginfo_class_ReflectionFunctionAbstract___clone ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invoke, 0, 0, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invokeArgs, 0, 0, 1) @@ -125,7 +125,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invoke, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, object, IS_OBJECT, 1, "null") - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invokeArgs, 0, 0, 2) @@ -221,7 +221,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isInstance, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0) ZEND_END_ARG_INFO() -#define arginfo_class_ReflectionClass_newInstance arginfo_class_ReflectionFunction_invoke +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_newInstance, 0, 0, 0) + ZEND_ARG_VARIADIC_INFO(0, args) +ZEND_END_ARG_INFO() #define arginfo_class_ReflectionClass_newInstanceWithoutConstructor arginfo_class_ReflectionFunctionAbstract___clone diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php index 21c711111e..85f12984aa 100755 --- a/ext/standard/basic_functions.stub.php +++ b/ext/standard/basic_functions.stub.php @@ -64,11 +64,11 @@ function krsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} function ksort(array &$arg, int $sort_flags = SORT_REGULAR): bool {} -/** @param mixed $var */ +/** @param array|Countable|null $var */ function count($var, int $mode = COUNT_NORMAL): int {} /** - * @param mixed $var + * @param array|object|null $var * @alias count */ function sizeof($var, int $mode = COUNT_NORMAL): int {} @@ -91,34 +91,24 @@ function uasort(array &$arg, callable $cmp_function): bool {} function uksort(array &$arg, callable $cmp_function): bool {} -/** @return mixed */ -function end(array|object &$arg) {} +function end(array|object &$arg): mixed {} -/** @return mixed */ -function prev(array|object &$arg) {} +function prev(array|object &$arg): mixed {} -/** @return mixed */ -function next(array|object &$arg) {} +function next(array|object &$arg): mixed {} -/** @return mixed */ -function reset(array|object &$arg) {} +function reset(array|object &$arg): mixed {} -/** @return mixed */ -function current(array|object $arg) {} +function current(array|object $arg): mixed {} -/** - * @return mixed - * @alias current - */ -function pos(array|object $arg) {} +/** @alias current */ +function pos(array|object $arg): mixed {} function key(array|object $arg): int|string|null {} -/** @return mixed */ -function min($arg, ...$args) {} +function min($arg, mixed ...$args): mixed {} -/** @return mixed */ -function max($arg, ...$args) {} +function max($arg, mixed ...$args): mixed {} function array_walk(array|object &$input, callable $funcname, $userdata = UNKNOWN): bool {} @@ -133,9 +123,9 @@ function extract(array &$arg, int $extract_type = EXTR_OVERWRITE, string $prefix function compact($var_name, ...$var_names): array {} -function array_fill(int $start_key, int $num, $val): array {} +function array_fill(int $start_key, int $num, mixed $val): array {} -function array_fill_keys(array $keys, $val): array {} +function array_fill_keys(array $keys, mixed $val): array {} /** * @param int|float|string $low @@ -146,13 +136,11 @@ function range($low, $high, $step = 1): array {} function shuffle(array &$arg): bool {} -/** @return mixed */ -function array_pop(array &$stack) {} +function array_pop(array &$stack): mixed {} -/** @return mixed */ -function array_shift(array &$stack) {} +function array_shift(array &$stack): mixed {} -function array_unshift(array &$stack, ...$vars): int {} +function array_unshift(array &$stack, mixed ...$vars): int {} function array_splice(array &$arg, int $offset, ?int $length = null, $replacement = []): array {} @@ -180,7 +168,7 @@ function array_column(array $arg, int|string|null $column_key, int|string|null $ function array_reverse(array $input, bool $preserve_keys = false): array {} -function array_pad(array $arg, int $pad_size, $pad_value): array {} +function array_pad(array $arg, int $pad_size, mixed $pad_value): array {} function array_flip(array $arg): array {} @@ -234,18 +222,17 @@ function array_sum(array $arg): int|float {} function array_product(array $arg): int|float {} -/** @return mixed */ -function array_reduce(array $arg, callable $callback, $initial = null) {} +function array_reduce(array $arg, callable $callback, mixed $initial = null): mixed {} function array_filter(array $arg, ?callable $callback = null, int $use_keys = 0): array {} function array_map(?callable $callback, array $arr1, array ...$arrays): array {} -/** @param mixed $key */ +/** @param int|string $key */ function array_key_exists($key, array $search): bool {} /** - * @param mixed $key + * @param int|string $key * @alias array_key_exists */ function key_exists($key, array $search): bool {} @@ -262,8 +249,7 @@ function base64_decode(string $str, bool $strict = false): string|false {} /* basic_functions.c */ -/** @return mixed */ -function constant(string $name) {} +function constant(string $name): mixed {} function ip2long(string $ip_address): int|false {} @@ -299,29 +285,16 @@ function error_get_last(): ?array {} function error_clear_last(): void {} -/** - * @param mixed ...$args - * @return mixed - */ -function call_user_func(callable $function, ...$args) {} +function call_user_func(callable $function, mixed ...$args): mixed {} -/** @return mixed */ -function call_user_func_array(callable $function, array $args) {} +function call_user_func_array(callable $function, array $args): mixed {} -/** - * @param mixed ...$args - * @return mixed - */ -function forward_static_call(callable $function, ...$args) {} +function forward_static_call(callable $function, mixed ...$args): mixed {} -/** @return mixed */ -function forward_static_call_array(callable $function, array $args) {} +function forward_static_call_array(callable $function, array $args): mixed {} -/** - * @param callable $function - * @param mixed ...$args - */ -function register_shutdown_function($function, ...$args): ?bool {} +/** @param callable $function */ +function register_shutdown_function($function, mixed ...$args): ?bool {} function highlight_file(string $filename, bool $return = false): string|bool|null {} @@ -347,8 +320,7 @@ function set_include_path(string $include_path): string|false {} function get_include_path(): string|false {} -/** @param mixed $var */ -function print_r($var, bool $return = false): string|bool {} +function print_r(mixed $var, bool $return = false): string|bool {} function connection_aborted(): int {} @@ -372,8 +344,7 @@ function getprotobyname(string $name): int|false {} function getprotobynumber(int $protocol): string|false {} #endif -/** @param mixed $args */ -function register_tick_function(callable $function, ...$args): bool {} +function register_tick_function(callable $function, mixed ...$args): bool {} function unregister_tick_function($function): void {} @@ -666,7 +637,7 @@ function hebrev(string $str, int $max_chars_per_line = 0): string {} function nl2br(string $str, bool $is_xhtml = true): string {} -/** @param mixed $allowable_tags */ +/** @param array|string|null $allowable_tags */ function strip_tags(string $str, $allowable_tags = UNKNOWN): string {} /** @@ -812,11 +783,8 @@ function fread($handle, int $length): string|false {} */ function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) {} -/** - * @param resource $stream - * @param mixed ...$args - */ -function fscanf($stream, string $format, &...$args): array|int|false|null {} +/** @param resource $stream */ +function fscanf($stream, string $format, mixed &...$args): array|int|false|null {} /** @param resource $handle */ function fpassthru($handle): int {} @@ -868,11 +836,8 @@ function file_get_contents(string $filename, bool $use_include_path = false, $co /** @param resource|null $context */ function unlink(string $filename, $context = null): bool {} -/** - * @param mixed $content - * @param resource|null $context - */ -function file_put_contents(string $filename, $content, int $flags = 0, $context = null): int|false {} +/** @param resource|null $context */ +function file_put_contents(string $filename, mixed $content, int $flags = 0, $context = null): int|false {} /** @param resource $handle */ function fputcsv($handle, array $fields, string $delimiter = ",", string $enclosure = "\"", string $escape = "\\"): int|false {} @@ -960,21 +925,16 @@ function realpath_cache_size(): int {} /* formatted_print.c */ -/** @param mixed ...$args */ -function sprintf(string $format, ...$args): string {} +function sprintf(string $format, mixed ...$args): string {} -/** @param mixed ...$args */ -function printf(string $format, ...$args): int {} +function printf(string $format, mixed ...$args): int {} function vprintf(string $format, array $args): int {} function vsprintf(string $format, array $args): string {} -/** - * @param resource $handle - * @param mixed ...$args - */ -function fprintf($handle, string $format, ...$args): int {} +/** @param resource $handle */ +function fprintf($handle, string $format, mixed ...$args): int {} /** @param resource $handle */ function vfprintf($handle, string $format, array $args): int {} @@ -1093,8 +1053,7 @@ function intdiv(int $dividend, int $divisor): int {} function is_infinite(float $number): bool {} -/** @return mixed */ -function pow($base, $exp) {} +function pow($base, $exp): int|float|object {} function exp(float $number): float {} @@ -1226,7 +1185,7 @@ function stream_context_get_params($context): array {} * @param array|string $param2 * @param mixed $value */ -function stream_context_set_option($context, $param2, string $option_name = UNKNOWN, $value = UNKNOWN): bool {} +function stream_context_set_option($context, $param2, string $option_name = UNKNOWN, mixed $value = UNKNOWN): bool {} /** @param resource $stream_or_context */ function stream_context_get_options($stream_or_context): array {} @@ -1374,88 +1333,57 @@ function socket_set_timeout($socket, int $seconds, int $microseconds = 0): bool /* type.c */ -/** @param mixed $var */ -function gettype($var): string {} +function gettype(mixed $var): string {} -/** @param mixed $var */ -function get_debug_type($var): string {} +function get_debug_type(mixed $var): string {} function settype(&$var, string $type): bool {} -/** @param mixed $value */ -function intval($value, int $base = 10): int {} +function intval(mixed $value, int $base = 10): int {} -/** @param mixed $value */ -function floatval($value): float {} +function floatval(mixed $value): float {} -/** - * @param mixed $value - * @alias floatval - */ -function doubleval($value): float {} +/** @alias floatval */ +function doubleval(mixed $value): float {} -/** @param mixed $value */ -function boolval($value): bool {} +function boolval(mixed $value): bool {} -/** @param mixed $value */ -function strval($value): string {} +function strval(mixed $value): string {} -/** @param mixed $value */ -function is_null($value): bool {} +function is_null(mixed $value): bool {} -/** @param mixed $value */ -function is_resource($value): bool {} +function is_resource(mixed $value): bool {} -/** @param mixed $value */ -function is_bool($value): bool {} +function is_bool(mixed $value): bool {} -/** @param mixed $value */ -function is_int($value): bool {} +function is_int(mixed $value): bool {} -/** - * @param mixed $value - * @alias is_int - */ -function is_integer($value): bool {} +/** @alias is_int */ +function is_integer(mixed $value): bool {} -/** - * @param mixed $value - * @alias is_int - */ -function is_long($value): bool {} +/** @alias is_int */ +function is_long(mixed $value): bool {} -/** @param mixed $value */ -function is_float($value): bool {} +function is_float(mixed $value): bool {} -/** - * @param mixed $value - * @alias is_float - */ -function is_double($value): bool {} +/** @alias is_float */ +function is_double(mixed $value): bool {} -/** @param mixed $value */ -function is_numeric($value): bool {} +function is_numeric(mixed $value): bool {} -/** @param mixed $value */ -function is_string($value): bool {} +function is_string(mixed $value): bool {} -/** @param mixed $value */ -function is_array($value): bool {} +function is_array(mixed $value): bool {} -/** @param mixed $value */ -function is_object($value): bool {} +function is_object(mixed $value): bool {} -/** @param mixed $value */ -function is_scalar($value): bool {} +function is_scalar(mixed $value): bool {} -/** @param mixed $value */ -function is_callable($value, bool $syntax_only = false, &$callable_name = null): bool {} +function is_callable(mixed $value, bool $syntax_only = false, &$callable_name = null): bool {} -/** @param mixed $value */ -function is_iterable($value): bool {} +function is_iterable(mixed $value): bool {} -/** @param mixed $value */ -function is_countable($value): bool {} +function is_countable(mixed $value): bool {} /* uniqid.c */ @@ -1503,20 +1431,15 @@ function convert_uudecode(string $data): string|false {} /* var.c */ -/** @param mixed $value */ -function var_dump($value, ...$value): void {} +function var_dump(mixed $value, mixed ...$value): void {} -/** @param mixed $value */ -function var_export($value, bool $return = false): ?string {} +function var_export(mixed $value, bool $return = false): ?string {} -/** @param mixed $value */ -function debug_zval_dump($value, ...$value): void {} +function debug_zval_dump(mixed $value, mixed ...$value): void {} -/** @param mixed $value */ -function serialize($value): string {} +function serialize(mixed $value): string {} -/** @return mixed */ -function unserialize(string $value, array $options = []) {} +function unserialize(string $value, array $options = []): mixed {} function memory_get_usage(bool $real_usage = false): int {} diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h index b646c698d9..20b1ed6835 100755 --- a/ext/standard/basic_functions_arginfo.h +++ b/ext/standard/basic_functions_arginfo.h @@ -110,7 +110,7 @@ ZEND_END_ARG_INFO() #define arginfo_uksort arginfo_usort -ZEND_BEGIN_ARG_INFO_EX(arginfo_end, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_end, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_MASK(1, arg, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() @@ -120,7 +120,7 @@ ZEND_END_ARG_INFO() #define arginfo_reset arginfo_end -ZEND_BEGIN_ARG_INFO_EX(arginfo_current, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_current, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_MASK(0, arg, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() @@ -130,9 +130,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_key, 0, 1, MAY_BE_LONG|MAY_BE_ST ZEND_ARG_TYPE_MASK(0, arg, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_min, 0, 1, IS_MIXED, 0) ZEND_ARG_INFO(0, arg) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_max arginfo_min @@ -171,12 +171,12 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill, 0, 3, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, start_key, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0) - ZEND_ARG_INFO(0, val) + ZEND_ARG_TYPE_INFO(0, val, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill_keys, 0, 2, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) - ZEND_ARG_INFO(0, val) + ZEND_ARG_TYPE_INFO(0, val, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_range, 0, 2, IS_ARRAY, 0) @@ -187,7 +187,7 @@ ZEND_END_ARG_INFO() #define arginfo_shuffle arginfo_natsort -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_pop, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_pop, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -195,7 +195,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unshift, 0, 1, IS_LONG, 0) ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0) - ZEND_ARG_VARIADIC_INFO(0, vars) + ZEND_ARG_VARIADIC_TYPE_INFO(0, vars, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_splice, 0, 2, IS_ARRAY, 0) @@ -257,7 +257,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_pad, 0, 3, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, pad_size, IS_LONG, 0) - ZEND_ARG_INFO(0, pad_value) + ZEND_ARG_TYPE_INFO(0, pad_value, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_array_flip arginfo_array_values @@ -330,10 +330,10 @@ ZEND_END_ARG_INFO() #define arginfo_array_product arginfo_array_sum -ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_reduce, 0, 2, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, initial, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, initial, IS_MIXED, 0, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0) @@ -375,7 +375,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_base64_decode, 0, 1, MAY_BE_STRI ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, strict, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_constant, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_constant, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -447,12 +447,12 @@ ZEND_END_ARG_INFO() #define arginfo_error_clear_last arginfo_flush -ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_call_user_func, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_call_user_func_array, 0, 2, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0) ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -463,7 +463,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_shutdown_function, 0, 1, _IS_BOOL, 1) ZEND_ARG_INFO(0, function) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL) @@ -509,7 +509,7 @@ ZEND_END_ARG_INFO() #define arginfo_get_include_path arginfo_ob_get_flush ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_print_r, 0, 1, MAY_BE_STRING|MAY_BE_BOOL) - ZEND_ARG_INFO(0, var) + ZEND_ARG_TYPE_INFO(0, var, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -549,7 +549,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_tick_function, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_unregister_tick_function, 0, 1, IS_VOID, 0) @@ -1251,7 +1251,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fscanf, 0, 2, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(1, args) + ZEND_ARG_VARIADIC_TYPE_INFO(1, args, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_fpassthru arginfo_pclose @@ -1333,7 +1333,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_file_put_contents, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) - ZEND_ARG_INFO(0, content) + ZEND_ARG_TYPE_INFO(0, content, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null") ZEND_END_ARG_INFO() @@ -1470,12 +1470,12 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sprintf, 0, 1, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_printf, 0, 1, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_vprintf, 0, 2, IS_LONG, 0) @@ -1491,7 +1491,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fprintf, 0, 2, IS_LONG, 0) ZEND_ARG_INFO(0, handle) ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) - ZEND_ARG_VARIADIC_INFO(0, args) + ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_vfprintf, 0, 3, IS_LONG, 0) @@ -1672,7 +1672,7 @@ ZEND_END_ARG_INFO() #define arginfo_is_infinite arginfo_is_finite -ZEND_BEGIN_ARG_INFO_EX(arginfo_pow, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pow, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_OBJECT) ZEND_ARG_INFO(0, base) ZEND_ARG_INFO(0, exp) ZEND_END_ARG_INFO() @@ -1880,7 +1880,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_set_option, 0, 2, ZEND_ARG_INFO(0, context) ZEND_ARG_INFO(0, param2) ZEND_ARG_TYPE_INFO(0, option_name, IS_STRING, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_get_options, 0, 1, IS_ARRAY, 0) @@ -2052,7 +2052,7 @@ ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gettype, 0, 1, IS_STRING, 0) - ZEND_ARG_INFO(0, var) + ZEND_ARG_TYPE_INFO(0, var, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_get_debug_type arginfo_gettype @@ -2063,22 +2063,22 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_settype, 0, 2, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intval, 0, 1, IS_LONG, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, base, IS_LONG, 0, "10") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_floatval, 0, 1, IS_DOUBLE, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_doubleval arginfo_floatval ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_boolval, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strval, 0, 1, IS_STRING, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() #define arginfo_is_null arginfo_boolval @@ -2108,7 +2108,7 @@ ZEND_END_ARG_INFO() #define arginfo_is_scalar arginfo_boolval ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_callable, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, syntax_only, _IS_BOOL, 0, "false") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, callable_name, "null") ZEND_END_ARG_INFO() @@ -2173,12 +2173,12 @@ ZEND_END_ARG_INFO() #define arginfo_convert_uudecode arginfo_hex2bin ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_var_dump, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, value) - ZEND_ARG_VARIADIC_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) + ZEND_ARG_VARIADIC_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_var_export, 0, 1, IS_STRING, 1) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -2186,7 +2186,7 @@ ZEND_END_ARG_INFO() #define arginfo_serialize arginfo_strval -ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_unserialize, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() diff --git a/ext/xmlrpc/xmlrpc.stub.php b/ext/xmlrpc/xmlrpc.stub.php index 21193aeb48..e97a3d08ba 100644 --- a/ext/xmlrpc/xmlrpc.stub.php +++ b/ext/xmlrpc/xmlrpc.stub.php @@ -8,16 +8,13 @@ final class XmlRpcServer function xmlrpc_encode($value): ?string {} -/** @return mixed */ -function xmlrpc_decode(string $xml, string $encoding = "iso-8859-1") {} +function xmlrpc_decode(string $xml, string $encoding = "iso-8859-1"): mixed {} -/** @return mixed */ -function xmlrpc_decode_request(string $xml, &$method, string $encoding = "iso-8859-1") {} +function xmlrpc_decode_request(string $xml, &$method, string $encoding = "iso-8859-1"): mixed {} function xmlrpc_encode_request(?string $method, $params, array $output_options = UNKNOWN): ?string {} -/** @param mixed $value */ -function xmlrpc_get_type($value): string {} +function xmlrpc_get_type(mixed $value): string {} function xmlrpc_set_type(&$value, string $type): bool {} @@ -29,11 +26,9 @@ function xmlrpc_server_destroy(XmlRpcServer $server): bool {} function xmlrpc_server_register_method(XmlRpcServer $server, string $method_name, $function): bool {} -/** @return mixed */ -function xmlrpc_server_call_method(XmlRpcServer $server, string $xml, $user_data, array $output_options = UNKNOWN) {} +function xmlrpc_server_call_method(XmlRpcServer $server, string $xml, $user_data, array $output_options = UNKNOWN): mixed {} -/** @return mixed */ -function xmlrpc_parse_method_descriptions(string $xml) {} +function xmlrpc_parse_method_descriptions(string $xml): mixed {} function xmlrpc_server_add_introspection_data(XmlRpcServer $server, array $desc): int {} diff --git a/ext/xmlrpc/xmlrpc_arginfo.h b/ext/xmlrpc/xmlrpc_arginfo.h index b3ee59fd46..0a5d1198f8 100644 --- a/ext/xmlrpc/xmlrpc_arginfo.h +++ b/ext/xmlrpc/xmlrpc_arginfo.h @@ -4,12 +4,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode, 0, 1, IS_STRING, ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_decode, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 0, "\"iso-8859-1\"") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_decode_request, 0, 2, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0) ZEND_ARG_INFO(1, method) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 0, "\"iso-8859-1\"") @@ -22,7 +22,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode_request, 0, 2, IS_ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_get_type, 0, 1, IS_STRING, 0) - ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_set_type, 0, 2, _IS_BOOL, 0) @@ -47,14 +47,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_register_method, 0 ZEND_ARG_INFO(0, function) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 3, IS_MIXED, 0) ZEND_ARG_OBJ_INFO(0, server, XmlRpcServer, 0) ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0) ZEND_ARG_INFO(0, user_data) ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 1, IS_MIXED, 0) ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/ext/zend_test/test.stub.php b/ext/zend_test/test.stub.php index f3360fa7f3..232c268168 100644 --- a/ext/zend_test/test.stub.php +++ b/ext/zend_test/test.stub.php @@ -26,7 +26,6 @@ function zend_create_unterminated_string(string $str): string {} function zend_terminate_string(string &$str): void {} -/** @param mixed $variable */ -function zend_leak_variable($variable): void {} +function zend_leak_variable(mixed $variable): void {} function zend_leak_bytes(int $bytes = 3): void {} diff --git a/ext/zend_test/test_arginfo.h b/ext/zend_test/test_arginfo.h index 659d4eba66..495539bfbf 100644 --- a/ext/zend_test/test_arginfo.h +++ b/ext/zend_test/test_arginfo.h @@ -20,7 +20,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_terminate_string, 0, 1, IS_ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_leak_variable, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, variable) + ZEND_ARG_TYPE_INFO(0, variable, IS_MIXED, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_leak_bytes, 0, 0, IS_VOID, 0) |