summaryrefslogtreecommitdiff
path: root/ext/posix
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2019-11-08 23:29:12 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2019-11-11 14:54:55 +0100
commit27e83d0fb87c04b61441fb77e963dd4e14ad187e (patch)
tree1b35b21c48c54f353e643d29dd2306d8e1ba084a /ext/posix
parent2804ea612779b89d3c62d974eb35783dd31f7dee (diff)
downloadphp-git-27e83d0fb87c04b61441fb77e963dd4e14ad187e.tar.gz
Add union return types for function stubs
Diffstat (limited to 'ext/posix')
-rw-r--r--ext/posix/posix.stub.php44
-rw-r--r--ext/posix/posix_arginfo.h27
2 files changed, 28 insertions, 43 deletions
diff --git a/ext/posix/posix.stub.php b/ext/posix/posix.stub.php
index 625a087de6..008d35f689 100644
--- a/ext/posix/posix.stub.php
+++ b/ext/posix/posix.stub.php
@@ -27,13 +27,11 @@ function posix_setegid(int $gid): bool {}
#endif
#ifdef HAVE_GETGROUPS
-/** @return array|false */
-function posix_getgroups() {}
+function posix_getgroups(): array|false {}
#endif
#ifdef HAVE_GETLOGIN
-/** @return string|false */
-function posix_getlogin() {}
+function posix_getlogin(): string|false {}
#endif
function posix_getpgrp(): int {}
@@ -45,36 +43,27 @@ function posix_setsid(): int {}
function posix_setpgid(int $pid, int $pgid): bool {}
#ifdef HAVE_GETPGID
-/** @return int|false */
-function posix_getpgid(int $pid) {}
+function posix_getpgid(int $pid): int|false {}
#endif
#ifdef HAVE_GETSID
-/** @return int|false */
-function posix_getsid(int $pid) {}
+function posix_getsid(int $pid): int|false {}
#endif
-/** @return array|false */
-function posix_uname() {}
+function posix_uname(): array|false {}
-/** @return array|false */
-function posix_times() {}
+function posix_times(): array|false {}
#ifdef HAVE_CTERMID
-/** @return string|false */
-function posix_ctermid() {}
+function posix_ctermid(): string|false {}
#endif
-/**
- * @return string|false
- */
-function posix_ttyname($fd) {}
+function posix_ttyname($fd): string|false {}
function posix_isatty($fd): bool {}
-/** @return string|false */
-function posix_getcwd() {}
+function posix_getcwd(): string|false {}
#ifdef HAVE_MKFIFO
function posix_mkfifo(string $pathname, int $mode): bool {}
@@ -86,21 +75,16 @@ function posix_mknod(string $pathname, int $mode, int $major = 0, int $minor = 0
function posix_access(string $file, int $mode = 0): bool {}
-/** @return array|false */
-function posix_getgrnam(string $name) {}
+function posix_getgrnam(string $name): array|false {}
-/** @return array|false */
-function posix_getgrgid(int $gid) {}
+function posix_getgrgid(int $gid): array|false {}
-/** @return array|false */
-function posix_getpwnam(string $username) {}
+function posix_getpwnam(string $username): array|false {}
-/** @return array|false */
-function posix_getpwuid(int $uid) {}
+function posix_getpwuid(int $uid): array|false {}
#ifdef HAVE_GETRLIMIT
-/** @return array|false */
-function posix_getrlimit() {}
+function posix_getrlimit(): array|false {}
#endif
#ifdef HAVE_SETRLIMIT
diff --git a/ext/posix/posix_arginfo.h b/ext/posix/posix_arginfo.h
index 91042fb692..8997b409bf 100644
--- a/ext/posix/posix_arginfo.h
+++ b/ext/posix/posix_arginfo.h
@@ -39,12 +39,12 @@ ZEND_END_ARG_INFO()
#endif
#if defined(HAVE_GETGROUPS)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgroups, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgroups, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#endif
#if defined(HAVE_GETLOGIN)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getlogin, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getlogin, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#endif
@@ -61,28 +61,28 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setpgid, 0, 2, _IS_BOOL, 0
ZEND_END_ARG_INFO()
#if defined(HAVE_GETPGID)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpgid, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpgid, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
#if defined(HAVE_GETSID)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getsid, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getsid, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_uname, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_uname, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#define arginfo_posix_times arginfo_posix_uname
#if defined(HAVE_CTERMID)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ctermid, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_ctermid, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ttyname, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_ttyname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, fd)
ZEND_END_ARG_INFO()
@@ -90,7 +90,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_isatty, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, fd)
ZEND_END_ARG_INFO()
-#define arginfo_posix_getcwd arginfo_posix_uname
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getcwd, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
#if defined(HAVE_MKFIFO)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mkfifo, 0, 2, _IS_BOOL, 0)
@@ -113,24 +114,24 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_access, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrnam, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgrnam, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrgid, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgrgid, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwnam, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpwnam, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwuid, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpwuid, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
ZEND_END_ARG_INFO()
#if defined(HAVE_GETRLIMIT)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getrlimit, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getrlimit, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_END_ARG_INFO()
#endif