summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_closures.c11
-rw-r--r--Zend/zend_closures.stub.php18
-rw-r--r--Zend/zend_closures_arginfo.h22
3 files changed, 28 insertions, 23 deletions
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 02df3504cc..6bd5a8716b 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -600,20 +600,11 @@ ZEND_COLD ZEND_METHOD(Closure, __construct)
}
/* }}} */
-static const zend_function_entry closure_functions[] = {
- ZEND_ME(Closure, __construct, arginfo_class_Closure___construct, ZEND_ACC_PRIVATE)
- ZEND_ME(Closure, bind, arginfo_class_Closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_MALIAS(Closure, bindTo, bind, arginfo_class_Closure_bindTo, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, call, arginfo_class_Closure_call, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, fromCallable, arginfo_class_Closure_fromCallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_FE_END
-};
-
void zend_register_closure_ce(void) /* {{{ */
{
zend_class_entry ce;
- INIT_CLASS_ENTRY(ce, "Closure", closure_functions);
+ INIT_CLASS_ENTRY(ce, "Closure", class_Closure_methods);
zend_ce_closure = zend_register_internal_class(&ce);
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL;
zend_ce_closure->create_object = zend_closure_new;
diff --git a/Zend/zend_closures.stub.php b/Zend/zend_closures.stub.php
index 65ad4635da..75202c5df7 100644
--- a/Zend/zend_closures.stub.php
+++ b/Zend/zend_closures.stub.php
@@ -1,21 +1,19 @@
<?php
-Class Closure
+/** @generate-function-entries */
+
+final class Closure
{
private function __construct() {}
- /** @return ?Closure */
- public static function bind(Closure $closure, ?object $newthis, $newscope = UNKNOWN) {}
+ public static function bind(Closure $closure, ?object $newthis, $newscope = UNKNOWN): ?Closure {}
- /** @return ?Closure */
- public function bindTo(?object $newthis, $newscope = UNKNOWN) {}
+ /** @alias Closure::bind */
+ public function bindTo(?object $newthis, $newscope = UNKNOWN): ?Closure {}
/** @return mixed */
public function call(object $newthis, ...$parameters) {}
- /**
- * @param callable $callable Not a proper type annotation due to bug #78770
- * @return Closure
- */
- public function fromCallable($callable) {}
+ /** @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 91d019dc94..a1eddd7bc1 100644
--- a/Zend/zend_closures_arginfo.h
+++ b/Zend/zend_closures_arginfo.h
@@ -3,13 +3,13 @@
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure___construct, 0, 0, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bind, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Closure_bind, 0, 2, Closure, 1)
ZEND_ARG_OBJ_INFO(0, closure, Closure, 0)
ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
ZEND_ARG_INFO(0, newscope)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bindTo, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Closure_bindTo, 0, 1, Closure, 1)
ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
ZEND_ARG_INFO(0, newscope)
ZEND_END_ARG_INFO()
@@ -19,6 +19,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_call, 0, 0, 1)
ZEND_ARG_VARIADIC_INFO(0, parameters)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_fromCallable, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Closure_fromCallable, 0, 1, Closure, 0)
ZEND_ARG_INFO(0, callable)
ZEND_END_ARG_INFO()
+
+
+ZEND_METHOD(Closure, __construct);
+ZEND_METHOD(Closure, bind);
+ZEND_METHOD(Closure, call);
+ZEND_METHOD(Closure, fromCallable);
+
+
+static const zend_function_entry class_Closure_methods[] = {
+ ZEND_ME(Closure, __construct, arginfo_class_Closure___construct, ZEND_ACC_PRIVATE)
+ ZEND_ME(Closure, bind, arginfo_class_Closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_MALIAS(Closure, bindTo, bind, arginfo_class_Closure_bindTo, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, call, arginfo_class_Closure_call, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, fromCallable, arginfo_class_Closure_fromCallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_FE_END
+};