Skip to content

Commit c8f858e

Browse files
authored
Add more specific array return type hints for various extensions - part 4 (#7469)
1 parent 6a47831 commit c8f858e

File tree

7 files changed

+60
-3
lines changed

7 files changed

+60
-3
lines changed

Zend/Optimizer/zend_func_infos.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,22 @@ static const func_info_t func_infos[] = {
383383
F1("pg_update", MAY_BE_STRING|MAY_BE_BOOL),
384384
F1("pg_delete", MAY_BE_STRING|MAY_BE_BOOL),
385385
F1("pg_select", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_FALSE),
386+
#if defined(HAVE_GETGROUPS)
387+
F1("posix_getgroups", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
388+
#endif
389+
F1("posix_uname", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
390+
F1("posix_times", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
391+
F1("posix_getgrnam", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE),
392+
F1("posix_getgrgid", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_NULL|MAY_BE_FALSE),
393+
F1("posix_getpwnam", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
394+
F1("posix_getpwuid", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
395+
#if defined(HAVE_GETRLIMIT)
396+
F1("posix_getrlimit", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
397+
#endif
398+
F1("pspell_suggest", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
399+
#if defined(HAVE_HISTORY_LIST)
400+
F1("readline_list_history", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
401+
#endif
386402
F1("session_name", MAY_BE_STRING|MAY_BE_FALSE),
387403
F1("session_module_name", MAY_BE_STRING|MAY_BE_FALSE),
388404
F1("session_save_path", MAY_BE_STRING|MAY_BE_FALSE),

ext/posix/posix.stub.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function posix_setegid(int $group_id): bool {}
2929
#endif
3030

3131
#ifdef HAVE_GETGROUPS
32+
/**
33+
* @return array<int, int>|false
34+
* @refcount 1
35+
*/
3236
function posix_getgroups(): array|false {}
3337
#endif
3438

@@ -52,8 +56,16 @@ function posix_getpgid(int $process_id): int|false {}
5256
function posix_getsid(int $process_id): int|false {}
5357
#endif
5458

59+
/**
60+
* @return array<string, string>|false
61+
* @refcount 1
62+
*/
5563
function posix_uname(): array|false {}
5664

65+
/**
66+
* @return array<string, int>|false
67+
* @refcount 1
68+
*/
5769
function posix_times(): array|false {}
5870

5971

@@ -79,15 +91,35 @@ function posix_mknod(string $filename, int $flags, int $major = 0, int $minor =
7991

8092
function posix_access(string $filename, int $flags = 0): bool {}
8193

94+
/**
95+
* @return array<string, int|string|array|null>|false
96+
* @refcount 1
97+
*/
8298
function posix_getgrnam(string $name): array|false {}
8399

100+
/**
101+
* @return array<string, int|string|array|null>|false
102+
* @refcount 1
103+
*/
84104
function posix_getgrgid(int $group_id): array|false {}
85105

106+
/**
107+
* @return array<string, int|string>|false
108+
* @refcount 1
109+
*/
86110
function posix_getpwnam(string $username): array|false {}
87111

112+
/**
113+
* @return array<string, int|string>|false
114+
* @refcount 1
115+
*/
88116
function posix_getpwuid(int $user_id): array|false {}
89117

90118
#ifdef HAVE_GETRLIMIT
119+
/**
120+
* @return array<string, int|string>|false
121+
* @refcount 1
122+
*/
91123
function posix_getrlimit(): array|false {}
92124
#endif
93125

ext/posix/posix_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 954c403785617dade95048b4345a34d4ec5d91c3 */
2+
* Stub hash: b8806b9b67bf24cc64fe1957306f1c720a61ea58 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, process_id, IS_LONG, 0)

ext/pspell/pspell.stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ function pspell_new_personal(
3434
function pspell_new_config(PSpell\Config $config): PSpell\Dictionary|false {}
3535

3636
function pspell_check(PSpell\Dictionary $dictionary, string $word): bool {}
37+
38+
/**
39+
* @return array<int, string>|false
40+
* @refcount 1
41+
*/
3742
function pspell_suggest(PSpell\Dictionary $dictionary, string $word): array|false {}
3843
function pspell_store_replacement(PSpell\Dictionary $dictionary, string $misspelled, string $correct): bool {}
3944
function pspell_add_to_personal(PSpell\Dictionary $dictionary, string $word): bool {}

ext/pspell/pspell_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 04660f3f9559eed67a224d219d38ff80d131b118 */
2+
* Stub hash: 54253af8d28520254e062171733c753d7104ec6b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, PSpell\\Dictionary, MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)

ext/readline/readline.stub.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ function readline_add_history(string $prompt): bool {}
1212
function readline_clear_history(): bool {}
1313

1414
#ifdef HAVE_HISTORY_LIST
15+
/**
16+
* @return array<int, string>
17+
* @refcount 1
18+
*/
1519
function readline_list_history(): array {}
1620
#endif
1721

ext/readline/readline_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: aab1331f5ba0d8beeb62d5961ece7dc96a99a74c */
2+
* Stub hash: 1839e2895847790ef3db4263d4940fa1bc956ff2 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prompt, IS_STRING, 1, "null")

0 commit comments

Comments
 (0)