From 186f9bab45bb5677a223400e803fa2bae2f79719 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 9 Feb 2021 14:23:42 +0100 Subject: Make IntlDateFormatter ctor $pattern nullable The implementation already made this argument nullable, but it was not reflected in the stub. --- ext/intl/dateformat/dateformat.stub.php | 4 ++-- ext/intl/dateformat/dateformat_arginfo.h | 6 +++--- ext/intl/php_intl.stub.php | 2 +- ext/intl/php_intl_arginfo.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/intl') diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php index 22ece903c1..e6f9522dd4 100644 --- a/ext/intl/dateformat/dateformat.stub.php +++ b/ext/intl/dateformat/dateformat.stub.php @@ -8,14 +8,14 @@ class IntlDateFormatter * @param IntlTimeZone|DateTimeZone|string|null $timezone * @param IntlCalendar|int|null $calendar */ - public function __construct(?string $locale, int $dateType, int $timeType, $timezone = null, $calendar = null, string $pattern = "") {} + public function __construct(?string $locale, int $dateType, int $timeType, $timezone = null, $calendar = null, ?string $pattern = null) {} /** * @param IntlTimeZone|DateTimeZone|string|null $timezone * @return IntlDateFormatter|null * @alias datefmt_create */ - public static function create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, string $pattern = "") {} + public static function create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, ?string $pattern = null) {} /** * @return int|false diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h index ff9fbfa6fd..8830fa615e 100644 --- a/ext/intl/dateformat/dateformat_arginfo.h +++ b/ext/intl/dateformat/dateformat_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 62742b5f463272f43970e98900a89d513c4fb839 */ + * Stub hash: faeef90c9c1324c6a25f0df36c7239ddc2b43ee4 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) @@ -7,7 +7,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null") ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, calendar, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_create, 0, 0, 3) @@ -16,7 +16,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_create, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null") ZEND_ARG_OBJ_TYPE_MASK(0, calendar, IntlCalendar, MAY_BE_LONG|MAY_BE_NULL, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getDateType, 0, 0, 0) diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index 26b7922c2c..421c1ae3dc 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -154,7 +154,7 @@ function intl_error_name(int $errorCode): string {} /* dateformat */ /** @param IntlTimeZone|DateTimeZone|string|null $timezone */ -function datefmt_create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, string $pattern = ""): ?IntlDateFormatter {} +function datefmt_create(?string $locale, int $dateType, int $timeType, $timezone = null, IntlCalendar|int|null $calendar = null, ?string $pattern = null): ?IntlDateFormatter {} function datefmt_get_datetype(IntlDateFormatter $formatter): int|false {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 57299b841f..85cf63e585 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c890e3cde79ffeade4623001cc369aa734812959 */ + * Stub hash: 7600b5814e257cc334ec72fc0f4c73b6a84b2745 */ 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") @@ -282,7 +282,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_datefmt_create, 0, 3, IntlDateFor ZEND_ARG_TYPE_INFO(0, timeType, IS_LONG, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null") ZEND_ARG_OBJ_TYPE_MASK(0, calendar, IntlCalendar, MAY_BE_LONG|MAY_BE_NULL, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_datetype, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) -- cgit v1.2.1 From f5768eaa2e7d75cafbe80054c657fcf61b9394e6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 9 Feb 2021 14:18:18 +0100 Subject: Make NumberFormatter ctor $pattern nullable Whether the pattern is needed depends on the used style. If no pattern is needed, null is a more sensible value than an empty string. fixup --- ext/intl/formatter/formatter.stub.php | 4 ++-- ext/intl/formatter/formatter_arginfo.h | 4 ++-- ext/intl/formatter/formatter_main.c | 2 +- ext/intl/php_intl.stub.php | 2 +- ext/intl/php_intl_arginfo.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/intl') diff --git a/ext/intl/formatter/formatter.stub.php b/ext/intl/formatter/formatter.stub.php index 045b0640ce..19e6148b8a 100644 --- a/ext/intl/formatter/formatter.stub.php +++ b/ext/intl/formatter/formatter.stub.php @@ -4,13 +4,13 @@ class NumberFormatter { - public function __construct(string $locale, int $style, string $pattern = "") {} + public function __construct(string $locale, int $style, ?string $pattern = null) {} /** * @return NumberFormatter|null * @alias numfmt_create */ - public static function create(string $locale, int $style, string $pattern = "") {} + public static function create(string $locale, int $style, ?string $pattern = null) {} /** * @return string|false diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h index 79f977fb81..a621605977 100644 --- a/ext/intl/formatter/formatter_arginfo.h +++ b/ext/intl/formatter/formatter_arginfo.h @@ -1,10 +1,10 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0f285bbaa6f4f37060eb8325956f41bd86e9dea3 */ + * Stub hash: de7625297bcdb8c7e4944a319c019ed68508ea2c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_class_NumberFormatter_create arginfo_class_NumberFormatter___construct diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 8f44f33fa3..aacae86ca6 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -34,7 +34,7 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s", + if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s!", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { return FAILURE; diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index 421c1ae3dc..8600920a01 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -204,7 +204,7 @@ function datefmt_get_error_message(IntlDateFormatter $formatter): string {} /* formatter */ -function numfmt_create(string $locale, int $style, string $pattern = ""): ?NumberFormatter {} +function numfmt_create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter {} function numfmt_format(NumberFormatter $formatter, int|float $num, int $type = NumberFormatter::TYPE_DEFAULT): string|false {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 85cf63e585..351662024e 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7600b5814e257cc334ec72fc0f4c73b6a84b2745 */ + * Stub hash: fb91064c471d6bced3a6dad8beb56c92c9047e52 */ 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") @@ -370,7 +370,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_numfmt_create, 0, 2, NumberFormatter, 1) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 0, "\"\"") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pattern, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) -- cgit v1.2.1