From: Nikita Popov Date: Fri, 17 Jul 2020 10:40:05 +0000 (+0200) Subject: Fix IntlGregorianCalendar constructor signature X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4903f7c5fde11a115f659ec54a1d0ede6fd7232c;p=php Fix IntlGregorianCalendar constructor signature Give these conversative UNKNOWN defaults and no types, as the overload is something of a mess. --- diff --git a/ext/intl/calendar/calendar.stub.php b/ext/intl/calendar/calendar.stub.php index fafee62640..d704ab77c9 100644 --- a/ext/intl/calendar/calendar.stub.php +++ b/ext/intl/calendar/calendar.stub.php @@ -283,7 +283,7 @@ class IntlCalendar class IntlGregorianCalendar extends IntlCalendar { - public function __construct() {} + public function __construct($timeZoneOrYear = UNKNOWN, $localeOrMonth = UNKNOWN, $dayOfMonth = UNKNOWN, $hour = UNKNOWN, $minute = UNKNOWN, $second = UNKNOWN) {} /** * @return bool diff --git a/ext/intl/calendar/calendar_arginfo.h b/ext/intl/calendar/calendar_arginfo.h index d80500a887..5802d9f690 100644 --- a/ext/intl/calendar/calendar_arginfo.h +++ b/ext/intl/calendar/calendar_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e9aea4eb45aba216347d3cf821cf5adebc217ba1 */ + * Stub hash: 7261d52837a7ac393453511d2c29ee9106407236 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -142,7 +142,14 @@ ZEND_END_ARG_INFO() #define arginfo_class_IntlCalendar_toDateTime arginfo_class_IntlCalendar___construct -#define arginfo_class_IntlGregorianCalendar___construct arginfo_class_IntlCalendar___construct +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlGregorianCalendar___construct, 0, 0, 0) + ZEND_ARG_INFO(0, timeZoneOrYear) + ZEND_ARG_INFO(0, localeOrMonth) + ZEND_ARG_INFO(0, dayOfMonth) + ZEND_ARG_INFO(0, hour) + ZEND_ARG_INFO(0, minute) + ZEND_ARG_INFO(0, second) +ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlGregorianCalendar_setGregorianChange, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, change, IS_DOUBLE, 0) diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index 337a79c71a..9708f6d359 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -99,7 +99,7 @@ function intlcal_get_error_code(IntlCalendar $calendar): int|false {} function intlcal_get_error_message(IntlCalendar $calendar): string|false {} /** @param IntlTimeZone|DateTimeZone|string|null $timeZone */ -function intlgregcal_create_instance($timeZone = null, ?string $locale = null): ?IntlGregorianCalendar {} +function intlgregcal_create_instance($timeZoneOrYear = UNKNOWN, $localeOrMonth = UNKNOWN, $dayOfMonth = UNKNOWN, $hour = UNKNOWN, $minute = UNKNOWN, $second = UNKNOWN): ?IntlGregorianCalendar {} function intlgregcal_set_gregorian_change(IntlGregorianCalendar $calendar, float $change): bool {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 2e16d16be7..f9e2cbd152 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: f5411cdc67ac288183c4210932b222c406bfe254 */ + * Stub hash: 6130944985187815dd839f7425213f91c3261735 */ 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") @@ -179,8 +179,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_error_message, 0, 1, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlgregcal_create_instance, 0, 0, IntlGregorianCalendar, 1) - ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timeZone, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null") + ZEND_ARG_INFO(0, timeZoneOrYear) + ZEND_ARG_INFO(0, localeOrMonth) + ZEND_ARG_INFO(0, dayOfMonth) + ZEND_ARG_INFO(0, hour) + ZEND_ARG_INFO(0, minute) + ZEND_ARG_INFO(0, second) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlgregcal_set_gregorian_change, 0, 2, _IS_BOOL, 0) diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt index 1f8d90b518..dcea7aa1db 100644 --- a/ext/intl/tests/gregoriancalendar___construct_error.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt @@ -38,4 +38,4 @@ Too many arguments Too many arguments No variant with 4 arguments (excluding trailing NULLs) No variant with 4 arguments (excluding trailing NULLs) -IntlGregorianCalendar::__construct(): Argument #6 must be of type int, array given +IntlGregorianCalendar::__construct(): Argument #6 ($second) must be of type int, array given