diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-09 14:18:18 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-09 14:36:41 +0100 |
commit | f5768eaa2e7d75cafbe80054c657fcf61b9394e6 (patch) | |
tree | b70c974c030b471fab5bc3f3b5a2c1c998c27d3b | |
parent | 186f9bab45bb5677a223400e803fa2bae2f79719 (diff) | |
download | php-git-f5768eaa2e7d75cafbe80054c657fcf61b9394e6.tar.gz |
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
-rw-r--r-- | ext/intl/formatter/formatter.stub.php | 4 | ||||
-rw-r--r-- | ext/intl/formatter/formatter_arginfo.h | 4 | ||||
-rw-r--r-- | ext/intl/formatter/formatter_main.c | 2 | ||||
-rw-r--r-- | ext/intl/php_intl.stub.php | 2 | ||||
-rw-r--r-- | ext/intl/php_intl_arginfo.h | 4 |
5 files changed, 8 insertions, 8 deletions
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) |