Fix callable and iterable handling

This commit is contained in:
Máté Kocsis 2021-08-24 19:19:35 +02:00
parent bdfe0ab505
commit 4a7a414735
No known key found for this signature in database
GPG key ID: FD055E41728BF310
4 changed files with 20 additions and 13 deletions

View file

@ -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),
};

View file

@ -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<int, string|object>|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<int, string|object>|object|null */
/** @return callable|null */
function set_exception_handler(?callable $callback) {}
/** @return true */

View file

@ -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()

View file

@ -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,15 +362,16 @@ class SimpleType {
return "MAY_BE_OBJECT";
}
if ($this->name === "resource") {
return "MAY_BE_RESOURCE";
}
if ($this->name === "true") {
switch ($this->name) {
case "true":
return "MAY_BE_TRUE";
}
if ($this->name === "mixed") {
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";
}