Skip to content

Add more specific array return type hints for various extensions - part 4 #7469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,22 @@ static const func_info_t func_infos[] = {
F1("pg_update", MAY_BE_STRING|MAY_BE_BOOL),
F1("pg_delete", MAY_BE_STRING|MAY_BE_BOOL),
F1("pg_select", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_STRING|MAY_BE_FALSE),
#if defined(HAVE_GETGROUPS)
F1("posix_getgroups", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
#endif
F1("posix_uname", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("posix_times", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_FALSE),
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),
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),
F1("posix_getpwnam", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
F1("posix_getpwuid", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#if defined(HAVE_GETRLIMIT)
F1("posix_getrlimit", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#endif
F1("pspell_suggest", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE),
#if defined(HAVE_HISTORY_LIST)
F1("readline_list_history", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING),
#endif
F1("session_name", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_module_name", MAY_BE_STRING|MAY_BE_FALSE),
F1("session_save_path", MAY_BE_STRING|MAY_BE_FALSE),
Expand Down
32 changes: 32 additions & 0 deletions ext/posix/posix.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ function posix_setegid(int $group_id): bool {}
#endif

#ifdef HAVE_GETGROUPS
/**
* @return array<int, int>|false
* @refcount 1
*/
function posix_getgroups(): array|false {}
#endif

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

/**
* @return array<string, string>|false
* @refcount 1
*/
function posix_uname(): array|false {}

/**
* @return array<string, int>|false
* @refcount 1
*/
function posix_times(): array|false {}


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

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

/**
* @return array<string, int|string|array|null>|false
* @refcount 1
*/
function posix_getgrnam(string $name): array|false {}

/**
* @return array<string, int|string|array|null>|false
* @refcount 1
*/
function posix_getgrgid(int $group_id): array|false {}

/**
* @return array<string, int|string>|false
* @refcount 1
*/
function posix_getpwnam(string $username): array|false {}

/**
* @return array<string, int|string>|false
* @refcount 1
*/
function posix_getpwuid(int $user_id): array|false {}

#ifdef HAVE_GETRLIMIT
/**
* @return array<string, int|string>|false
* @refcount 1
*/
function posix_getrlimit(): array|false {}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ext/posix/posix_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 954c403785617dade95048b4345a34d4ec5d91c3 */
* Stub hash: b8806b9b67bf24cc64fe1957306f1c720a61ea58 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, process_id, IS_LONG, 0)
Expand Down
5 changes: 5 additions & 0 deletions ext/pspell/pspell.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function pspell_new_personal(
function pspell_new_config(PSpell\Config $config): PSpell\Dictionary|false {}

function pspell_check(PSpell\Dictionary $dictionary, string $word): bool {}

/**
* @return array<int, string>|false
* @refcount 1
*/
function pspell_suggest(PSpell\Dictionary $dictionary, string $word): array|false {}
function pspell_store_replacement(PSpell\Dictionary $dictionary, string $misspelled, string $correct): bool {}
function pspell_add_to_personal(PSpell\Dictionary $dictionary, string $word): bool {}
Expand Down
2 changes: 1 addition & 1 deletion ext/pspell/pspell_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 04660f3f9559eed67a224d219d38ff80d131b118 */
* Stub hash: 54253af8d28520254e062171733c753d7104ec6b */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, PSpell\\Dictionary, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
Expand Down
4 changes: 4 additions & 0 deletions ext/readline/readline.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function readline_add_history(string $prompt): bool {}
function readline_clear_history(): bool {}

#ifdef HAVE_HISTORY_LIST
/**
* @return array<int, string>
* @refcount 1
*/
function readline_list_history(): array {}
#endif

Expand Down
2 changes: 1 addition & 1 deletion ext/readline/readline_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: aab1331f5ba0d8beeb62d5961ece7dc96a99a74c */
* Stub hash: 1839e2895847790ef3db4263d4940fa1bc956ff2 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, prompt, IS_STRING, 1, "null")
Expand Down