]> granicus.if.org Git - php/commitdiff
Add stubs for WeakReference
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 31 Oct 2019 11:17:04 +0000 (12:17 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 31 Oct 2019 11:17:04 +0000 (12:17 +0100)
Zend/zend_weakrefs.c
Zend/zend_weakrefs.stub.php [new file with mode: 0644]
Zend/zend_weakrefs_arginfo.h [new file with mode: 0644]

index aae1998d6ca5705e36cdaf7ff295e229803fee7b..0d6b9345f68dec6f06646ebe98adc926af565dcb 100644 (file)
@@ -18,6 +18,7 @@
 #include "zend_interfaces.h"
 #include "zend_objects_API.h"
 #include "zend_weakrefs.h"
+#include "zend_weakrefs_arginfo.h"
 
 typedef struct _zend_weakref {
        zend_object *referent;
@@ -140,13 +141,6 @@ static ZEND_COLD void zend_weakref_no_unset(zend_object *object, zend_string *me
        zend_weakref_unsupported("properties");
 }
 
-ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(zend_weakref_create_arginfo, 0, 1, WeakReference, 0)
-       ZEND_ARG_TYPE_INFO(0, referent, IS_OBJECT, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(zend_weakref_get_arginfo, 0, 0, IS_OBJECT, 1)
-ZEND_END_ARG_INFO()
-
 ZEND_COLD ZEND_METHOD(WeakReference, __construct)
 {
        zend_throw_error(NULL,
@@ -178,9 +172,9 @@ ZEND_METHOD(WeakReference, get)
 }
 
 static const zend_function_entry zend_weakref_methods[] = {
-       ZEND_ME(WeakReference, __construct, NULL, ZEND_ACC_PUBLIC)
-       ZEND_ME(WeakReference, create,  zend_weakref_create_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-       ZEND_ME(WeakReference, get, zend_weakref_get_arginfo, ZEND_ACC_PUBLIC)
+       ZEND_ME(WeakReference, __construct, arginfo_class_WeakReference___construct, ZEND_ACC_PUBLIC)
+       ZEND_ME(WeakReference, create, arginfo_class_WeakReference_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+       ZEND_ME(WeakReference, get, arginfo_class_WeakReference_get, ZEND_ACC_PUBLIC)
        ZEND_FE_END
 };
 
diff --git a/Zend/zend_weakrefs.stub.php b/Zend/zend_weakrefs.stub.php
new file mode 100644 (file)
index 0000000..52ae81c
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+final class WeakReference {
+    public function __construct();
+
+    public static function create(): WeakReference;
+
+    public function get(): ?object;
+}
diff --git a/Zend/zend_weakrefs_arginfo.h b/Zend/zend_weakrefs_arginfo.h
new file mode 100644 (file)
index 0000000..abcd0c8
--- /dev/null
@@ -0,0 +1,10 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_WeakReference___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_WeakReference_create, 0, 0, WeakReference, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakReference_get, 0, 0, IS_OBJECT, 1)
+ZEND_END_ARG_INFO()