Skip to content

Declare a few missing function return types #7395

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

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 4 additions & 10 deletions ext/intl/php_intl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,8 @@ function normalizer_get_raw_decomposition(string $string, int $form = Normalizer

function resourcebundle_create(?string $locale, ?string $bundle, bool $fallback = true): ?ResourceBundle {}

/**
* @param string|int $index
* @return mixed
*/
function resourcebundle_get(ResourceBundle $bundle, $index, bool $fallback = true) {}
/** @param string|int $index */
function resourcebundle_get(ResourceBundle $bundle, $index, bool $fallback = true): mixed {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I saw, only a float return type is impossible, so using mixed seems to be warranted.


function resourcebundle_count(ResourceBundle $bundle): int {}

Expand All @@ -369,11 +366,8 @@ function intltz_count_equivalent_ids(string $timezoneId): int|false {}

function intltz_create_default(): IntlTimeZone {}

/**
* @param IntlTimeZone|string|int|float|null $countryOrRawOffset
* @return IntlIterator|false
*/
function intltz_create_enumeration($countryOrRawOffset = null) {}
/** @param IntlTimeZone|string|int|float|null $countryOrRawOffset */
function intltz_create_enumeration($countryOrRawOffset = null): IntlIterator|false {}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this one was missed. The return type seems straightforward.


function intltz_create_time_zone(string $timezoneId): ?IntlTimeZone {}

Expand Down
6 changes: 3 additions & 3 deletions ext/intl/php_intl_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: 9d40cc3b008e968f4ae28e147209095c698334a5 */
* Stub hash: 55a689451b2c1ff5900c47111d350168f3ddec00 */

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
Expand Down Expand Up @@ -630,7 +630,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_resourcebundle_create, 0, 2, Reso
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fallback, _IS_BOOL, 0, "true")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_get, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_get, 0, 2, IS_MIXED, 0)
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
ZEND_ARG_INFO(0, index)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, fallback, _IS_BOOL, 0, "true")
Expand All @@ -657,7 +657,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_create_default, 0, 0, IntlTimeZone, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_intltz_create_enumeration, 0, 0, 0)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intltz_create_enumeration, 0, 0, IntlIterator, MAY_BE_FALSE)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, countryOrRawOffset, "null")
ZEND_END_ARG_INFO()

Expand Down
3 changes: 1 addition & 2 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1423,8 +1423,7 @@ function uniqid(string $prefix = "", bool $more_entropy = false): string {}

/* url.c */

/** @return mixed */
function parse_url(string $url, int $component = -1) {}
function parse_url(string $url, int $component = -1): int|string|array|null|false {}

function urlencode(string $string): string {}

Expand Down
4 changes: 2 additions & 2 deletions ext/standard/basic_functions_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: 8a11321dffd77850616db42a5c77fc33c30b361f */
* Stub hash: 963bd7624ec5f981ac9074eef94f9da740aa5108 */

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
Expand Down Expand Up @@ -2095,7 +2095,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_uniqid, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
#endif

ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_url, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_parse_url, 0, 1, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, component, IS_LONG, 0, "-1")
ZEND_END_ARG_INFO()
Expand Down