Skip to content

Commit 4a7a414

Browse files
committed
Fix callable and iterable handling
1 parent bdfe0ab commit 4a7a414

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

Zend/Optimizer/zend_func_infos.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ static const func_info_t func_infos[] = {
6161
FN("oci_password_change", MAY_BE_RESOURCE|MAY_BE_BOOL),
6262
FN("oci_new_cursor", MAY_BE_RESOURCE|MAY_BE_FALSE),
6363
F1("pg_socket", MAY_BE_RESOURCE|MAY_BE_FALSE),
64+
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),
6465
};

Zend/zend_builtin_functions.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ function trigger_error(string $message, int $error_level = E_USER_NOTICE): bool
9191
/** @alias trigger_error */
9292
function user_error(string $message, int $error_level = E_USER_NOTICE): bool {}
9393

94-
/** @return string|array<int, string|object>|object|null */
94+
/** @return callable|null */
9595
function set_error_handler(?callable $callback, int $error_levels = E_ALL) {}
9696

9797
/** @return true */
9898
function restore_error_handler(): bool {}
9999

100-
/** @return string|array<int, string|object>|object|null */
100+
/** @return callable|null */
101101
function set_exception_handler(?callable $callback) {}
102102

103103
/** @return true */

Zend/zend_builtin_functions_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: cf84a097dab1a043133faf0b03f002748b3c8eda */
2+
* Stub hash: 830eee0780adba8fc87cd5aed7f755d4d85ed82b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
55
ZEND_END_ARG_INFO()

build/gen_stub.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ public static function fromString(string $typeString): SimpleType
192192
case "int":
193193
case "float":
194194
case "string":
195+
case "callable":
195196
case "iterable":
196197
case "object":
197198
case "resource":
@@ -297,8 +298,12 @@ public function toTypeMask(): string {
297298
return "MAY_BE_OBJECT";
298299
case "callable":
299300
return "MAY_BE_CALLABLE";
301+
case "iterable":
302+
return "MAY_BE_ITERABLE";
300303
case "mixed":
301304
return "MAY_BE_ANY";
305+
case "void":
306+
return "MAY_BE_VOID";
302307
case "static":
303308
return "MAY_BE_STATIC";
304309
case "never":
@@ -357,16 +362,17 @@ public function toOptimizerTypeMask(): string {
357362
return "MAY_BE_OBJECT";
358363
}
359364

360-
if ($this->name === "resource") {
361-
return "MAY_BE_RESOURCE";
362-
}
363-
364-
if ($this->name === "true") {
365-
return "MAY_BE_TRUE";
366-
}
367-
368-
if ($this->name === "mixed") {
369-
return "MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY";
365+
switch ($this->name) {
366+
case "true":
367+
return "MAY_BE_TRUE";
368+
case "resource":
369+
return "MAY_BE_RESOURCE";
370+
case "callable":
371+
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";
372+
case "iterable":
373+
return "MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_OBJECT";
374+
case "mixed":
375+
return "MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY";
370376
}
371377

372378
return $this->toTypeMask();

0 commit comments

Comments
 (0)