summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-31 12:17:04 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-10-31 12:17:04 +0100
commit2f8b7668386a7c4ede409e6ab7d4d93ce9316def (patch)
treed71f2d48fc87c21e986944d494b37abfaa10a34d
parent1517bc4426d5da5a7c1b151ff1fbc5b2bdb2b9b9 (diff)
downloadphp-git-2f8b7668386a7c4ede409e6ab7d4d93ce9316def.tar.gz
Add stubs for WeakReference
-rw-r--r--Zend/zend_weakrefs.c14
-rw-r--r--Zend/zend_weakrefs.stub.php9
-rw-r--r--Zend/zend_weakrefs_arginfo.h10
3 files changed, 23 insertions, 10 deletions
diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c
index aae1998d6c..0d6b9345f6 100644
--- a/Zend/zend_weakrefs.c
+++ b/Zend/zend_weakrefs.c
@@ -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
index 0000000000..52ae81c7b8
--- /dev/null
+++ b/Zend/zend_weakrefs.stub.php
@@ -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
index 0000000000..abcd0c8d99
--- /dev/null
+++ b/Zend/zend_weakrefs_arginfo.h
@@ -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()