Merge branch 'PHP-8.0'

* PHP-8.0:
  Use E_ERROR to report arginfo/zpp mismatch
  Make NumberFormatter ctor $pattern nullable
  Make IntlDateFormatter ctor $pattern nullable
This commit is contained in:
Nikita Popov 2021-02-09 14:37:41 +01:00
commit 9d54609a19
8 changed files with 16 additions and 16 deletions

View File

@ -1144,7 +1144,7 @@ static zend_always_inline bool zend_internal_call_should_throw(zend_function *fb
static ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc)
{
zend_error(E_CORE_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
zend_error(E_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
fbc->common.scope ? "::" : "",
ZSTR_VAL(fbc->common.function_name));

View File

@ -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

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 4f93c3fca18c225b26dec1e970b783baa4622425 */
* Stub hash: a83ee23ab33293a878280f137260da9f8914218a */
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)

View File

@ -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

View File

@ -1,10 +1,10 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 2a232c97981e23bec14f03e564a7ec3d7fedc31e */
* Stub hash: 4fa61766d54f40d3295da0992b16e08ede9aaab1 */
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

View File

@ -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;

View File

@ -158,7 +158,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 {}
@ -208,7 +208,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 {}

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 9ddf3e4e42735c34a8b53a1856d6dc93346afc6f */
* Stub hash: 9d6b4d36a39e4bb346ea0d45d4be8c941070bd67 */
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)
@ -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)