]> granicus.if.org Git - php/commitdiff
Added arginfo stubs for sysvsem
authorStephen Reay <stephen.reay@me.com>
Sun, 11 Aug 2019 17:52:30 +0000 (00:52 +0700)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 12 Aug 2019 08:05:36 +0000 (10:05 +0200)
Closes GH-4523.

ext/sysvsem/sysvsem.c
ext/sysvsem/sysvsem.stub.php [new file with mode: 0644]
ext/sysvsem/sysvsem_arginfo.h [new file with mode: 0644]

index 6086d1f066a4bb50e99f38b8fa04c96f7a167864..4945d4ee2f31129ddb3a092ab651a0afff4604b6 100644 (file)
@@ -38,6 +38,7 @@
 #include <sys/sem.h>
 #include <errno.h>
 
+#include "sysvsem_arginfo.h"
 #include "php_sysvsem.h"
 #include "ext/standard/info.h"
 
@@ -55,28 +56,6 @@ union semun {
 
 #endif
 
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
-       ZEND_ARG_INFO(0, key)
-       ZEND_ARG_INFO(0, max_acquire)
-       ZEND_ARG_INFO(0, perm)
-       ZEND_ARG_INFO(0, auto_release)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_acquire, 0, 0, 1)
-       ZEND_ARG_INFO(0, sem_identifier)
-       ZEND_ARG_INFO(0, nowait)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_release, 0, 0, 1)
-       ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_remove, 0, 0, 1)
-       ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-/* }}} */
-
 /* {{{ sysvsem_functions[]
  */
 static const zend_function_entry sysvsem_functions[] = {
diff --git a/ext/sysvsem/sysvsem.stub.php b/ext/sysvsem/sysvsem.stub.php
new file mode 100644 (file)
index 0000000..cb64eec
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @todo use bool for $auto_release
+ * @return resource|false
+ */
+function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_release = 1) {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_acquire($sem_identifier, bool $nowait = false): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_release($sem_identifier): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_remove($sem_identifier): bool {}
diff --git a/ext/sysvsem/sysvsem_arginfo.h b/ext/sysvsem/sysvsem_arginfo.h
new file mode 100644 (file)
index 0000000..f45cae2
--- /dev/null
@@ -0,0 +1,19 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
+       ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO(0, max_acquire, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO(0, auto_release, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_acquire, 0, 1, _IS_BOOL, 0)
+       ZEND_ARG_INFO(0, sem_identifier)
+       ZEND_ARG_TYPE_INFO(0, nowait, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_release, 0, 1, _IS_BOOL, 0)
+       ZEND_ARG_INFO(0, sem_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sem_remove arginfo_sem_release