diff --git a/composer.json b/composer.json index 09768d9..de295bd 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,14 @@ "prefer-stable": true, "autoload-dev": { "classmap": [ - "src/php/ecma_intl.stub.php" + "src/php/classes/category.stub.php", + "src/php/classes/intl.stub.php", + "src/php/classes/locale.stub.php", + "src/php/classes/locale_character_direction.stub.php", + "src/php/classes/locale_options.stub.php", + "src/php/classes/locale_text_info.stub.php", + "src/php/classes/locale_week_day.stub.php", + "src/php/classes/locale_week_info.stub.php" ] }, "config": { diff --git a/package.xml b/package.xml index 074ec45..dacaf6a 100644 --- a/package.xml +++ b/package.xml @@ -77,25 +77,39 @@ Fix: ensure build directories are created for each source directory, fixing an i + + + + + + + + + + + + + + + + - - diff --git a/src/php/classes/category.c b/src/php/classes/category.c index 5e0eeda..d5ea8a8 100644 --- a/src/php/classes/category.c +++ b/src/php/classes/category.c @@ -12,8 +12,12 @@ #include "php/classes/category.h" +#include "php/classes/category_arginfo.h" + zend_class_entry *ecma_ce_IntlCategory = NULL; -void registerEcmaIntlCategory() { +PHP_MINIT_FUNCTION(ecma_intl_category) { ecma_ce_IntlCategory = register_class_Ecma_Intl_Category(); + + return SUCCESS; } diff --git a/src/php/classes/category.h b/src/php/classes/category.h index eac3d03..64bd599 100644 --- a/src/php/classes/category.h +++ b/src/php/classes/category.h @@ -17,6 +17,6 @@ extern zend_class_entry *ecma_ce_IntlCategory; -void registerEcmaIntlCategory(void); +PHP_MINIT_FUNCTION(ecma_intl_category); #endif /* ECMA_INTL_PHP_CLASSES_CATEGORY_H */ diff --git a/src/php/classes/category.stub.php b/src/php/classes/category.stub.php new file mode 100644 index 0000000..7f785fc --- /dev/null +++ b/src/php/classes/category.stub.php @@ -0,0 +1,33 @@ + #include zend_class_entry *ecma_ce_Intl = NULL; -void registerEcmaIntl() { ecma_ce_Intl = register_class_Ecma_Intl(); } +PHP_MINIT_FUNCTION(ecma_intl) { + ecma_ce_Intl = register_class_Ecma_Intl(); + + return SUCCESS; +} PHP_METHOD(Ecma_Intl, __construct) { ZEND_PARSE_PARAMETERS_NONE(); } diff --git a/src/php/classes/intl.h b/src/php/classes/intl.h index 2c2d59b..6fdbed3 100644 --- a/src/php/classes/intl.h +++ b/src/php/classes/intl.h @@ -17,6 +17,6 @@ extern zend_class_entry *ecma_ce_Intl; -void registerEcmaIntl(void); +PHP_MINIT_FUNCTION(ecma_intl); #endif /* ECMA_INTL_PHP_CLASSES_INTL_H */ diff --git a/src/php/classes/intl.stub.php b/src/php/classes/intl.stub.php new file mode 100644 index 0000000..fd1152a --- /dev/null +++ b/src/php/classes/intl.stub.php @@ -0,0 +1,72 @@ +|\Stringable|string|null $locales + * + * @return string[] + */ + public static function getCanonicalLocales(iterable|\Stringable|string|null $locales): array + { + } + + /** + * Returns an array containing the supported calendar, collation, + * currency, numbering systems, or unit values supported by this + * implementation. + * + * @link https://tc39.es/ecma402/#sec-intl.supportedvaluesof ECMA-402, section 8.3.2, Intl.supportedValuesOf + * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf MDN: Intl.supportedValuesOf() + * + * @return string[] + */ + public static function supportedValuesOf(Intl\Category $category): array + { + } + + /** + * Intl may not be instantiated. + */ + private function __construct() + { + } + } +} diff --git a/src/php/classes/intl_arginfo.h b/src/php/classes/intl_arginfo.h new file mode 100644 index 0000000..d0e09d7 --- /dev/null +++ b/src/php/classes/intl_arginfo.h @@ -0,0 +1,51 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 868093634998e28b498ffe100b93c61ad2000765 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_getCanonicalLocales, 0, 1, IS_ARRAY, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, locales, Traversable|Stringable, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, NULL) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_supportedValuesOf, 0, 1, IS_ARRAY, 0) + ZEND_ARG_OBJ_INFO(0, category, Ecma\\Intl\\Category, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + + +ZEND_METHOD(Ecma_Intl, getCanonicalLocales); +ZEND_METHOD(Ecma_Intl, supportedValuesOf); +ZEND_METHOD(Ecma_Intl, __construct); + + +static const zend_function_entry class_Ecma_Intl_methods[] = { + ZEND_ME(Ecma_Intl, getCanonicalLocales, arginfo_class_Ecma_Intl_getCanonicalLocales, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(Ecma_Intl, supportedValuesOf, arginfo_class_Ecma_Intl_supportedValuesOf, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(Ecma_Intl, __construct, arginfo_class_Ecma_Intl___construct, ZEND_ACC_PRIVATE) + ZEND_FE_END +}; + +static zend_class_entry *register_class_Ecma_Intl(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "Ecma", "Intl", class_Ecma_Intl_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + zval const_ICU_VERSION_value; + zend_string *const_ICU_VERSION_value_str = zend_string_init(U_ICU_VERSION, strlen(U_ICU_VERSION), 1); + ZVAL_STR(&const_ICU_VERSION_value, const_ICU_VERSION_value_str); + zend_string *const_ICU_VERSION_name = zend_string_init_interned("ICU_VERSION", sizeof("ICU_VERSION") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_ICU_VERSION_name, &const_ICU_VERSION_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_ICU_VERSION_name); + + zval const_UNICODE_VERSION_value; + zend_string *const_UNICODE_VERSION_value_str = zend_string_init(U_UNICODE_VERSION, strlen(U_UNICODE_VERSION), 1); + ZVAL_STR(&const_UNICODE_VERSION_value, const_UNICODE_VERSION_value_str); + zend_string *const_UNICODE_VERSION_name = zend_string_init_interned("UNICODE_VERSION", sizeof("UNICODE_VERSION") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_UNICODE_VERSION_name, &const_UNICODE_VERSION_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_UNICODE_VERSION_name); + + return class_entry; +} diff --git a/src/php/classes/locale.c b/src/php/classes/locale.c index abec8ac..78244c2 100644 --- a/src/php/classes/locale.c +++ b/src/php/classes/locale.c @@ -26,6 +26,8 @@ #include "php/classes/locale_week_day.h" #include "php/classes/locale_week_info.h" +#include "php/classes/locale_arginfo.h" + #include #include #include @@ -80,7 +82,7 @@ static void setWeekInfo(zend_object *object, ecma402_locale *locale); static UCalendarDaysOfWeek weekDayEcmaToIcu(ecma402_dayOfWeek day); static ecma402_dayOfWeek weekDayIcuToEcma(UCalendarDaysOfWeek day); -void registerEcmaIntlLocale() { +PHP_MINIT_FUNCTION(ecma_intl_locale) { ecma_ce_IntlLocale = register_class_Ecma_Intl_Locale(php_json_serializable_ce, zend_ce_stringable); ecma_ce_IntlLocale->create_object = ecma_createIntlLocale; @@ -90,6 +92,8 @@ void registerEcmaIntlLocale() { ecma_handlers_IntlLocale.offset = XtOffsetOf(ecma_IntlLocale, std); ecma_handlers_IntlLocale.free_obj = freeLocaleObj; + + return SUCCESS; } zend_object *ecma_createIntlLocale(zend_class_entry *classEntry) { diff --git a/src/php/classes/locale.h b/src/php/classes/locale.h index ae77c3f..4b47301 100644 --- a/src/php/classes/locale.h +++ b/src/php/classes/locale.h @@ -31,7 +31,8 @@ static inline ecma_IntlLocale *ecma_IntlLocaleFromObj(zend_object *obj) { extern zend_class_entry *ecma_ce_IntlLocale; extern zend_object_handlers ecma_handlers_IntlLocale; -void registerEcmaIntlLocale(void); zend_object *ecma_createIntlLocale(zend_class_entry *classEntry); +PHP_MINIT_FUNCTION(ecma_intl_locale); + #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_H */ diff --git a/src/php/ecma_intl.stub.php b/src/php/classes/locale.stub.php similarity index 60% rename from src/php/ecma_intl.stub.php rename to src/php/classes/locale.stub.php index e6dde68..fd2fbf9 100644 --- a/src/php/ecma_intl.stub.php +++ b/src/php/classes/locale.stub.php @@ -14,80 +14,8 @@ * @generate-class-entries */ -namespace Ecma -{ - final class Intl - { - /** - * The current ICU library version. - * - * @var string - * @cvalue U_ICU_VERSION - */ - public const ICU_VERSION = UNKNOWN; - - /** - * Unicode version number. - * - * @var string - * @cvalue U_UNICODE_VERSION - */ - public const UNICODE_VERSION = UNKNOWN; - - /** - * Returns an array of canonical locale names for the input locale(s). - * - * @link https://tc39.es/ecma402/#sec-intl.getcanonicallocales ECMA-402, section 8.3.1, Intl.getCanoncialLocales - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales MDN: Intl.getCanonicalLocales() - * - * @phpstan-param iterable<\Stringable|string>|\Stringable|string|null $locales - * - * @return string[] - */ - public static function getCanonicalLocales(iterable|\Stringable|string|null $locales): array - { - } - - /** - * Returns an array containing the supported calendar, collation, - * currency, numbering systems, or unit values supported by this - * implementation. - * - * @link https://tc39.es/ecma402/#sec-intl.supportedvaluesof ECMA-402, section 8.3.2, Intl.supportedValuesOf - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf MDN: Intl.supportedValuesOf() - * - * @return string[] - */ - public static function supportedValuesOf(Intl\Category $category): array - { - } - - /** - * Intl may not be instantiated. - */ - private function __construct() - { - } - } -} - namespace Ecma\Intl { - /** - * Categories of values supported by this implementation. - * - * @link https://tc39.es/ecma402/#sec-intl.supportedvaluesof ECMA-402, section 8.3.2, Intl.supportedValuesOf - */ - enum Category: string - { - case Calendar = 'calendar'; - case Collation = 'collation'; - case Currency = 'currency'; - case NumberingSystem = 'numberingSystem'; - case TimeZone = 'timeZone'; - case Unit = 'unit'; - } - /** * A Locale represents a Unicode locale identifier. * @@ -519,277 +447,3 @@ public function toString(): string } } } - -namespace Ecma\Intl\Locale -{ - /** - * The character direction of a locale - * - * @link https://tc39.es/proposal-intl-locale-info/#sec-character-direction-of-locale Intl Locale Info Proposal: CharacterDirectionOfLocale - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo MDN: Intl.Locale.prototype.getTextInfo() - */ - enum CharacterDirection: string - { - case LeftToRight = 'ltr'; - case RightToLeft = 'rtl'; - } - - /** - * Configuration for the locale. - * - * Any property set on the Options object passed to the Locale's - * constructor will override the same properties on the language tag passed - * to the Locale. - * - * @link https://tc39.es/ecma402/#sec-intl-locale-constructor ECMA-402: The Intl.Locale Constructor - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale MDN: Intl.Locale() constructor - * - * @strict-properties - */ - readonly class Options implements \Iterator, \JsonSerializable - { - /** - * The calendar to set on the locale. - */ - public readonly ?string $calendar; - - /** - * The case sorting algorithm to set on the locale. - */ - public readonly ?string $caseFirst; - - /** - * The collation algorithm to set on the locale. - */ - public readonly ?string $collation; - - /** - * The hour cycle to set on the locale. - */ - public readonly ?string $hourCycle; - - /** - * The language to set on the locale. - */ - public readonly ?string $language; - - /** - * The locale's numbering system - */ - public readonly ?string $numberingSystem; - - /** - * Whether to sort a sequence of decimal digits with its numeric value - * (i.e, "A-21" < "A-123") - */ - public readonly ?bool $numeric; - - /** - * The locale's region. - */ - public readonly ?string $region; - - /** - * The locale's script. - */ - public readonly ?string $script; - - /** - * Configuration for the locale - * - * Any property set on the Options object passed to the Locale's - * constructor will override the same properties on the language tag passed - * to the Locale. - * - * @link https://tc39.es/ecma402/#sec-intl-locale-constructor ECMA-402: The Intl.Locale Constructor - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale MDN: Intl.Locale() constructor - * - * @param \Stringable|string|null $calendar The calendar to use with the locale - * @param \Stringable|string|false|null $caseFirst The case sorting algorithm to use with the locale - * @param \Stringable|string|null $collation The collation algorithm to use with the locale - * @param \Stringable|string|null $hourCycle The hour cycle to use with the locale - * @param \Stringable|string|null $language The locale's language - * @param \Stringable|string|null $numberingSystem The locale's numbering system - * @param bool|null $numeric Whether to sort a sequence of decimal digits with its numeric value (i.e, "A-21" < "A-123") - * @param \Stringable|string|null $region The locale's region - * @param \Stringable|string|null $script The locale's script - */ - public function __construct( - \Stringable|string|null $calendar = null, - \Stringable|string|false|null $caseFirst = null, - \Stringable|string|null $collation = null, - \Stringable|string|null $hourCycle = null, - \Stringable|string|null $language = null, - \Stringable|string|null $numberingSystem = null, - ?bool $numeric = null, - \Stringable|string|null $region = null, - \Stringable|string|null $script = null, - ) { - } - - /** - * Returns an object of these options, suitable for serializing to JSON. - * - * @return object - */ - public function jsonSerialize(): object - { - } - - /** - * Returns the current element when iterating over the object properties. - * - * This allows the object to be used in array unpacking scenarios. For - * example: - * - * ```php - * use Ecma\Intl\Locale\Options; - * $commonOptions = new Options(hourCycle: 'h23'); - * $englishOptions = new Options(...[...$commonOptions, 'language' => 'en']); - * ``` - * - * Please note that `null` values will be skipped when iterating over - * them. This facilitates scenarios where you might return JSON-encoded - * values to be used by `Intl.Locale` instances in JavaScript. - */ - public function current(): string|bool - { - } - - public function next(): void - { - } - - public function key(): string - { - } - - public function valid(): bool - { - } - - public function rewind(): void - { - } - } - - /** - * TextInfo represents typesetting information for the locale. - * - * @link https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTextInfo Intl Locale Info Proposal: getTextInfo() - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo MDN: Intl.Locale.prototype.getTextInfo() - * @link https://www.unicode.org/reports/tr35/tr35-general.html#Layout_Elements UTS 35: Layout Elements - */ - readonly class TextInfo implements \JsonSerializable - { - /** - * The character direction of the locale. - */ - public readonly CharacterDirection $direction; - - /** - * TextInfo represents typesetting information for the locale. - * - * @link https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getTextInfo Intl Locale Info Proposal: getTextInfo() - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo MDN: Intl.Locale.prototype.getTextInfo() - * @link https://www.unicode.org/reports/tr35/tr35-general.html#Layout_Elements UTS 35: Layout Elements - * - * @param CharacterDirection $direction The character direction of the locale. - */ - public function __construct(CharacterDirection $direction) - { - } - - /** - * Returns an object of TextInfo properties and their values, suitable - * for serializing to JSON. - * - * @return object - */ - public function jsonSerialize(): object - { - } - } - - /** - * Days of the week. - * - * Each case is mapped to an integer value corresponding to the values - * defined in {@link https://tc39.es/proposal-intl-locale-info/#table-locale-weekinfo-record WeekInfo Record Fields}. - */ - enum WeekDay: int - { - case Monday = 1; - case Tuesday = 2; - case Wednesday = 3; - case Thursday = 4; - case Friday = 5; - case Saturday = 6; - case Sunday = 7; - } - - /** - * WeekInfo represents locale-specific information about the days of the - * week, for calendar purposes. - * - * @link https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getWeekInfo Intl Locale Info Proposal: getTextInfo() - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo Intl.Locale.prototype.getWeekInfo() - * @link https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Patterns_Week_Elements UTS 35: Week Elements - */ - readonly class WeekInfo implements \JsonSerializable - { - /** - * The week day that is considered the first day of the week - * for the locale. - */ - public readonly WeekDay $firstDay; - - /** - * The minimum days required in the first week of a month or year - * for the locale. - * - * @phpstan-var int<1, 7> - */ - public readonly int $minimalDays; - - /** - * A list of week days that are considered part of the weekend - * for the locale. - * - * Please note, the number of weekend days in each locale may be - * different, and they may not be contiguous. - * - * @var WeekDay[] - */ - public readonly array $weekend; - - /** - * WeekInfo represents locale-specific information about the days of the - * week, for calendar purposes. - * - * @link https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getWeekInfo Intl Locale Info Proposal: getTextInfo() - * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo Intl.Locale.prototype.getWeekInfo() - * @link https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Patterns_Week_Elements UTS 35: Week Elements - * - * @param WeekDay $firstDay The week day that is considered the _first_ day of the week. - * @param WeekDay[] $weekend A list of week days that are considered part of the weekend. - * @phpstan-param int<1, 7> $minimalDays The minimum days required in the first week of a month or year. - */ - public function __construct( - WeekDay $firstDay, - array $weekend, - int $minimalDays, - ) { - } - - /** - * Returns an object of WeekInfo properties and their values, suitable - * for serializing to JSON. - * - * @return object - */ - public function jsonSerialize(): object - { - } - } -} diff --git a/src/php/classes/locale_arginfo.h b/src/php/classes/locale_arginfo.h new file mode 100644 index 0000000..7bb7e5e --- /dev/null +++ b/src/php/classes/locale_arginfo.h @@ -0,0 +1,196 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: cf2c7dbd741357caa57cd75d5b77f7289ff5fc9f */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale___construct, 0, 0, 1) + ZEND_ARG_OBJ_TYPE_MASK(0, tag, Stringable, MAY_BE_STRING, NULL) + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, options, Ecma\\Intl\\Locale\\Options, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_getCalendars, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_Ecma_Intl_Locale_getCollations arginfo_class_Ecma_Intl_Locale_getCalendars + +#define arginfo_class_Ecma_Intl_Locale_getCurrencies arginfo_class_Ecma_Intl_Locale_getCalendars + +#define arginfo_class_Ecma_Intl_Locale_getHourCycles arginfo_class_Ecma_Intl_Locale_getCalendars + +#define arginfo_class_Ecma_Intl_Locale_getNumberingSystems arginfo_class_Ecma_Intl_Locale_getCalendars + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_getTextInfo, 0, 0, Ecma\\Intl\\Locale\\TextInfo, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_getTimeZones, 0, 0, IS_ARRAY, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_getWeekInfo, 0, 0, Ecma\\Intl\\Locale\\WeekInfo, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_jsonSerialize, 0, 0, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_maximize, 0, 0, Ecma\\Intl\\Locale, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_Ecma_Intl_Locale_minimize arginfo_class_Ecma_Intl_Locale_maximize + +#define arginfo_class_Ecma_Intl_Locale_toString arginfo_class_Ecma_Intl_Locale___toString + + +ZEND_METHOD(Ecma_Intl_Locale, __construct); +ZEND_METHOD(Ecma_Intl_Locale, toString); +ZEND_METHOD(Ecma_Intl_Locale, getCalendars); +ZEND_METHOD(Ecma_Intl_Locale, getCollations); +ZEND_METHOD(Ecma_Intl_Locale, getCurrencies); +ZEND_METHOD(Ecma_Intl_Locale, getHourCycles); +ZEND_METHOD(Ecma_Intl_Locale, getNumberingSystems); +ZEND_METHOD(Ecma_Intl_Locale, getTextInfo); +ZEND_METHOD(Ecma_Intl_Locale, getTimeZones); +ZEND_METHOD(Ecma_Intl_Locale, getWeekInfo); +ZEND_METHOD(Ecma_Intl_Locale, jsonSerialize); +ZEND_METHOD(Ecma_Intl_Locale, maximize); +ZEND_METHOD(Ecma_Intl_Locale, minimize); + + +static const zend_function_entry class_Ecma_Intl_Locale_methods[] = { + ZEND_ME(Ecma_Intl_Locale, __construct, arginfo_class_Ecma_Intl_Locale___construct, ZEND_ACC_PUBLIC) + ZEND_MALIAS(Ecma_Intl_Locale, __toString, toString, arginfo_class_Ecma_Intl_Locale___toString, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getCalendars, arginfo_class_Ecma_Intl_Locale_getCalendars, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getCollations, arginfo_class_Ecma_Intl_Locale_getCollations, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getCurrencies, arginfo_class_Ecma_Intl_Locale_getCurrencies, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getHourCycles, arginfo_class_Ecma_Intl_Locale_getHourCycles, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getNumberingSystems, arginfo_class_Ecma_Intl_Locale_getNumberingSystems, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getTextInfo, arginfo_class_Ecma_Intl_Locale_getTextInfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getTimeZones, arginfo_class_Ecma_Intl_Locale_getTimeZones, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, getWeekInfo, arginfo_class_Ecma_Intl_Locale_getWeekInfo, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, jsonSerialize, arginfo_class_Ecma_Intl_Locale_jsonSerialize, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, maximize, arginfo_class_Ecma_Intl_Locale_maximize, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, minimize, arginfo_class_Ecma_Intl_Locale_minimize, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale, toString, arginfo_class_Ecma_Intl_Locale_toString, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static zend_class_entry *register_class_Ecma_Intl_Locale(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_Stringable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl", "Locale", class_Ecma_Intl_Locale_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_READONLY_CLASS; + zend_class_implements(class_entry, 2, class_entry_JsonSerializable, class_entry_Stringable); + + zval property_baseName_default_value; + ZVAL_UNDEF(&property_baseName_default_value); + zend_string *property_baseName_name = zend_string_init("baseName", sizeof("baseName") - 1, 1); + zend_declare_typed_property(class_entry, property_baseName_name, &property_baseName_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_baseName_name); + + zval property_calendar_default_value; + ZVAL_UNDEF(&property_calendar_default_value); + zend_string *property_calendar_name = zend_string_init("calendar", sizeof("calendar") - 1, 1); + zend_declare_typed_property(class_entry, property_calendar_name, &property_calendar_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_calendar_name); + + zval property_calendars_default_value; + ZVAL_UNDEF(&property_calendars_default_value); + zend_string *property_calendars_name = zend_string_init("calendars", sizeof("calendars") - 1, 1); + zend_declare_typed_property(class_entry, property_calendars_name, &property_calendars_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_calendars_name); + + zval property_caseFirst_default_value; + ZVAL_UNDEF(&property_caseFirst_default_value); + zend_string *property_caseFirst_name = zend_string_init("caseFirst", sizeof("caseFirst") - 1, 1); + zend_declare_typed_property(class_entry, property_caseFirst_name, &property_caseFirst_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_caseFirst_name); + + zval property_collation_default_value; + ZVAL_UNDEF(&property_collation_default_value); + zend_string *property_collation_name = zend_string_init("collation", sizeof("collation") - 1, 1); + zend_declare_typed_property(class_entry, property_collation_name, &property_collation_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_collation_name); + + zval property_collations_default_value; + ZVAL_UNDEF(&property_collations_default_value); + zend_string *property_collations_name = zend_string_init("collations", sizeof("collations") - 1, 1); + zend_declare_typed_property(class_entry, property_collations_name, &property_collations_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_collations_name); + + zval property_currencies_default_value; + ZVAL_UNDEF(&property_currencies_default_value); + zend_string *property_currencies_name = zend_string_init("currencies", sizeof("currencies") - 1, 1); + zend_declare_typed_property(class_entry, property_currencies_name, &property_currencies_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_currencies_name); + + zval property_hourCycle_default_value; + ZVAL_UNDEF(&property_hourCycle_default_value); + zend_string *property_hourCycle_name = zend_string_init("hourCycle", sizeof("hourCycle") - 1, 1); + zend_declare_typed_property(class_entry, property_hourCycle_name, &property_hourCycle_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_hourCycle_name); + + zval property_hourCycles_default_value; + ZVAL_UNDEF(&property_hourCycles_default_value); + zend_string *property_hourCycles_name = zend_string_init("hourCycles", sizeof("hourCycles") - 1, 1); + zend_declare_typed_property(class_entry, property_hourCycles_name, &property_hourCycles_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_hourCycles_name); + + zval property_language_default_value; + ZVAL_UNDEF(&property_language_default_value); + zend_string *property_language_name = zend_string_init("language", sizeof("language") - 1, 1); + zend_declare_typed_property(class_entry, property_language_name, &property_language_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_language_name); + + zval property_numberingSystem_default_value; + ZVAL_UNDEF(&property_numberingSystem_default_value); + zend_string *property_numberingSystem_name = zend_string_init("numberingSystem", sizeof("numberingSystem") - 1, 1); + zend_declare_typed_property(class_entry, property_numberingSystem_name, &property_numberingSystem_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_numberingSystem_name); + + zval property_numberingSystems_default_value; + ZVAL_UNDEF(&property_numberingSystems_default_value); + zend_string *property_numberingSystems_name = zend_string_init("numberingSystems", sizeof("numberingSystems") - 1, 1); + zend_declare_typed_property(class_entry, property_numberingSystems_name, &property_numberingSystems_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_numberingSystems_name); + + zval property_numeric_default_value; + ZVAL_UNDEF(&property_numeric_default_value); + zend_string *property_numeric_name = zend_string_init("numeric", sizeof("numeric") - 1, 1); + zend_declare_typed_property(class_entry, property_numeric_name, &property_numeric_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL)); + zend_string_release(property_numeric_name); + + zval property_region_default_value; + ZVAL_UNDEF(&property_region_default_value); + zend_string *property_region_name = zend_string_init("region", sizeof("region") - 1, 1); + zend_declare_typed_property(class_entry, property_region_name, &property_region_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_region_name); + + zval property_script_default_value; + ZVAL_UNDEF(&property_script_default_value); + zend_string *property_script_name = zend_string_init("script", sizeof("script") - 1, 1); + zend_declare_typed_property(class_entry, property_script_name, &property_script_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_script_name); + + zend_string *property_textInfo_class_Ecma_Intl_Locale_TextInfo = zend_string_init("Ecma\\Intl\\Locale\\TextInfo", sizeof("Ecma\\Intl\\Locale\\TextInfo")-1, 1); + zval property_textInfo_default_value; + ZVAL_UNDEF(&property_textInfo_default_value); + zend_string *property_textInfo_name = zend_string_init("textInfo", sizeof("textInfo") - 1, 1); + zend_declare_typed_property(class_entry, property_textInfo_name, &property_textInfo_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_textInfo_class_Ecma_Intl_Locale_TextInfo, 0, 0)); + zend_string_release(property_textInfo_name); + + zval property_timeZones_default_value; + ZVAL_UNDEF(&property_timeZones_default_value); + zend_string *property_timeZones_name = zend_string_init("timeZones", sizeof("timeZones") - 1, 1); + zend_declare_typed_property(class_entry, property_timeZones_name, &property_timeZones_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL)); + zend_string_release(property_timeZones_name); + + zend_string *property_weekInfo_class_Ecma_Intl_Locale_WeekInfo = zend_string_init("Ecma\\Intl\\Locale\\WeekInfo", sizeof("Ecma\\Intl\\Locale\\WeekInfo")-1, 1); + zval property_weekInfo_default_value; + ZVAL_UNDEF(&property_weekInfo_default_value); + zend_string *property_weekInfo_name = zend_string_init("weekInfo", sizeof("weekInfo") - 1, 1); + zend_declare_typed_property(class_entry, property_weekInfo_name, &property_weekInfo_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_weekInfo_class_Ecma_Intl_Locale_WeekInfo, 0, 0)); + zend_string_release(property_weekInfo_name); + + return class_entry; +} diff --git a/src/php/classes/locale_character_direction.c b/src/php/classes/locale_character_direction.c index 21f65b7..c11e9c9 100644 --- a/src/php/classes/locale_character_direction.c +++ b/src/php/classes/locale_character_direction.c @@ -12,9 +12,13 @@ #include "php/classes/locale_character_direction.h" +#include "php/classes/locale_character_direction_arginfo.h" + zend_class_entry *ecma_ce_IntlLocaleCharacterDirection = NULL; -void registerEcmaIntlLocaleCharacterDirection() { +PHP_MINIT_FUNCTION(ecma_intl_locale_characterdirection) { ecma_ce_IntlLocaleCharacterDirection = register_class_Ecma_Intl_Locale_CharacterDirection(); + + return SUCCESS; } diff --git a/src/php/classes/locale_character_direction.h b/src/php/classes/locale_character_direction.h index f98f032..3d1a96b 100644 --- a/src/php/classes/locale_character_direction.h +++ b/src/php/classes/locale_character_direction.h @@ -17,6 +17,6 @@ extern zend_class_entry *ecma_ce_IntlLocaleCharacterDirection; -void registerEcmaIntlLocaleCharacterDirection(void); +PHP_MINIT_FUNCTION(ecma_intl_locale_characterdirection); #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_CHARACTER_DIRECTION_H */ diff --git a/src/php/classes/locale_character_direction.stub.php b/src/php/classes/locale_character_direction.stub.php new file mode 100644 index 0000000..7f1e376 --- /dev/null +++ b/src/php/classes/locale_character_direction.stub.php @@ -0,0 +1,30 @@ + @@ -59,7 +61,7 @@ static void setRegion(zend_object *object, zend_string *paramStr, static void setScript(zend_object *object, zend_string *paramStr, zend_object *paramObj); -void registerEcmaIntlLocaleOptions() { +PHP_MINIT_FUNCTION(ecma_intl_locale_options) { ecma_ce_IntlLocaleOptions = register_class_Ecma_Intl_Locale_Options( zend_ce_iterator, php_json_serializable_ce); ecma_ce_IntlLocaleOptions->create_object = ecma_createIntlLocaleOptions; @@ -70,6 +72,8 @@ void registerEcmaIntlLocaleOptions() { ecma_handlers_IntlLocaleOptions.offset = XtOffsetOf(ecma_IntlLocaleOptions, std); ecma_handlers_IntlLocaleOptions.free_obj = freeLocaleOptionsObj; + + return SUCCESS; } zend_object *ecma_createIntlLocaleOptions(zend_class_entry *classEntry) { diff --git a/src/php/classes/locale_options.h b/src/php/classes/locale_options.h index fd4ab39..7c9e746 100644 --- a/src/php/classes/locale_options.h +++ b/src/php/classes/locale_options.h @@ -46,7 +46,8 @@ ecma_IntlLocaleOptionsFromObj(zend_object *obj) { extern zend_class_entry *ecma_ce_IntlLocaleOptions; extern zend_object_handlers ecma_handlers_IntlLocaleOptions; -void registerEcmaIntlLocaleOptions(void); zend_object *ecma_createIntlLocaleOptions(zend_class_entry *classEntry); +PHP_MINIT_FUNCTION(ecma_intl_locale_options); + #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_OPTIONS_H */ diff --git a/src/php/classes/locale_options.stub.php b/src/php/classes/locale_options.stub.php new file mode 100644 index 0000000..64b5a09 --- /dev/null +++ b/src/php/classes/locale_options.stub.php @@ -0,0 +1,157 @@ + 'en']); + * ``` + * + * Please note that `null` values will be skipped when iterating over + * them. This facilitates scenarios where you might return JSON-encoded + * values to be used by `Intl.Locale` instances in JavaScript. + */ + public function current(): string|bool + { + } + + public function next(): void + { + } + + public function key(): string + { + } + + public function valid(): bool + { + } + + public function rewind(): void + { + } + } +} diff --git a/src/php/classes/locale_options_arginfo.h b/src/php/classes/locale_options_arginfo.h new file mode 100644 index 0000000..9570f22 --- /dev/null +++ b/src/php/classes/locale_options_arginfo.h @@ -0,0 +1,118 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: a240aabaa65649a7d5a95dc92b9ad0c2752da348 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options___construct, 0, 0, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, calendar, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, caseFirst, Stringable, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, collation, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, hourCycle, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, language, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, numberingSystem, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, numeric, _IS_BOOL, 1, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, region, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, script, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_jsonSerialize, 0, 0, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Ecma_Intl_Locale_Options_current, 0, 0, MAY_BE_STRING|MAY_BE_BOOL) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_next, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_key, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_valid, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_Ecma_Intl_Locale_Options_rewind arginfo_class_Ecma_Intl_Locale_Options_next + + +ZEND_METHOD(Ecma_Intl_Locale_Options, __construct); +ZEND_METHOD(Ecma_Intl_Locale_Options, jsonSerialize); +ZEND_METHOD(Ecma_Intl_Locale_Options, current); +ZEND_METHOD(Ecma_Intl_Locale_Options, next); +ZEND_METHOD(Ecma_Intl_Locale_Options, key); +ZEND_METHOD(Ecma_Intl_Locale_Options, valid); +ZEND_METHOD(Ecma_Intl_Locale_Options, rewind); + + +static const zend_function_entry class_Ecma_Intl_Locale_Options_methods[] = { + ZEND_ME(Ecma_Intl_Locale_Options, __construct, arginfo_class_Ecma_Intl_Locale_Options___construct, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, jsonSerialize, arginfo_class_Ecma_Intl_Locale_Options_jsonSerialize, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, current, arginfo_class_Ecma_Intl_Locale_Options_current, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, next, arginfo_class_Ecma_Intl_Locale_Options_next, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, key, arginfo_class_Ecma_Intl_Locale_Options_key, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, valid, arginfo_class_Ecma_Intl_Locale_Options_valid, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_Options, rewind, arginfo_class_Ecma_Intl_Locale_Options_rewind, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static zend_class_entry *register_class_Ecma_Intl_Locale_Options(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_JsonSerializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl\\Locale", "Options", class_Ecma_Intl_Locale_Options_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_READONLY_CLASS; + zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_JsonSerializable); + + zval property_calendar_default_value; + ZVAL_UNDEF(&property_calendar_default_value); + zend_string *property_calendar_name = zend_string_init("calendar", sizeof("calendar") - 1, 1); + zend_declare_typed_property(class_entry, property_calendar_name, &property_calendar_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_calendar_name); + + zval property_caseFirst_default_value; + ZVAL_UNDEF(&property_caseFirst_default_value); + zend_string *property_caseFirst_name = zend_string_init("caseFirst", sizeof("caseFirst") - 1, 1); + zend_declare_typed_property(class_entry, property_caseFirst_name, &property_caseFirst_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_caseFirst_name); + + zval property_collation_default_value; + ZVAL_UNDEF(&property_collation_default_value); + zend_string *property_collation_name = zend_string_init("collation", sizeof("collation") - 1, 1); + zend_declare_typed_property(class_entry, property_collation_name, &property_collation_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_collation_name); + + zval property_hourCycle_default_value; + ZVAL_UNDEF(&property_hourCycle_default_value); + zend_string *property_hourCycle_name = zend_string_init("hourCycle", sizeof("hourCycle") - 1, 1); + zend_declare_typed_property(class_entry, property_hourCycle_name, &property_hourCycle_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_hourCycle_name); + + zval property_language_default_value; + ZVAL_UNDEF(&property_language_default_value); + zend_string *property_language_name = zend_string_init("language", sizeof("language") - 1, 1); + zend_declare_typed_property(class_entry, property_language_name, &property_language_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_language_name); + + zval property_numberingSystem_default_value; + ZVAL_UNDEF(&property_numberingSystem_default_value); + zend_string *property_numberingSystem_name = zend_string_init("numberingSystem", sizeof("numberingSystem") - 1, 1); + zend_declare_typed_property(class_entry, property_numberingSystem_name, &property_numberingSystem_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_numberingSystem_name); + + zval property_numeric_default_value; + ZVAL_UNDEF(&property_numeric_default_value); + zend_string *property_numeric_name = zend_string_init("numeric", sizeof("numeric") - 1, 1); + zend_declare_typed_property(class_entry, property_numeric_name, &property_numeric_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL|MAY_BE_NULL)); + zend_string_release(property_numeric_name); + + zval property_region_default_value; + ZVAL_UNDEF(&property_region_default_value); + zend_string *property_region_name = zend_string_init("region", sizeof("region") - 1, 1); + zend_declare_typed_property(class_entry, property_region_name, &property_region_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_region_name); + + zval property_script_default_value; + ZVAL_UNDEF(&property_script_default_value); + zend_string *property_script_name = zend_string_init("script", sizeof("script") - 1, 1); + zend_declare_typed_property(class_entry, property_script_name, &property_script_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); + zend_string_release(property_script_name); + + return class_entry; +} diff --git a/src/php/classes/locale_text_info.c b/src/php/classes/locale_text_info.c index adf7c22..f62465c 100644 --- a/src/php/classes/locale_text_info.c +++ b/src/php/classes/locale_text_info.c @@ -14,6 +14,8 @@ #include "php/classes/locale_character_direction.h" +#include "php/classes/locale_text_info_arginfo.h" + #include zend_class_entry *ecma_ce_IntlLocaleTextInfo = NULL; @@ -21,7 +23,7 @@ zend_object_handlers ecma_handlers_IntlLocaleTextInfo; static void freeLocaleTextInfoObj(zend_object *object); -void registerEcmaIntlLocaleTextInfo() { +PHP_MINIT_FUNCTION(ecma_intl_locale_textinfo) { ecma_ce_IntlLocaleTextInfo = register_class_Ecma_Intl_Locale_TextInfo(php_json_serializable_ce); ecma_ce_IntlLocaleTextInfo->create_object = ecma_createIntlLocaleTextInfo; @@ -32,6 +34,8 @@ void registerEcmaIntlLocaleTextInfo() { ecma_handlers_IntlLocaleTextInfo.offset = XtOffsetOf(ecma_IntlLocaleTextInfo, std); ecma_handlers_IntlLocaleTextInfo.free_obj = freeLocaleTextInfoObj; + + return SUCCESS; } zend_object *ecma_createIntlLocaleTextInfo(zend_class_entry *classEntry) { diff --git a/src/php/classes/locale_text_info.h b/src/php/classes/locale_text_info.h index 9dbc9f8..479dc83 100644 --- a/src/php/classes/locale_text_info.h +++ b/src/php/classes/locale_text_info.h @@ -30,7 +30,8 @@ ecma_IntlLocaleTextInfoFromObj(zend_object *obj) { extern zend_class_entry *ecma_ce_IntlLocaleTextInfo; extern zend_object_handlers ecma_handlers_IntlLocaleTextInfo; -void registerEcmaIntlLocaleTextInfo(void); zend_object *ecma_createIntlLocaleTextInfo(zend_class_entry *classEntry); +PHP_MINIT_FUNCTION(ecma_intl_locale_textinfo); + #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_TEXT_INFO_H */ diff --git a/src/php/classes/locale_text_info.stub.php b/src/php/classes/locale_text_info.stub.php new file mode 100644 index 0000000..56b00b2 --- /dev/null +++ b/src/php/classes/locale_text_info.stub.php @@ -0,0 +1,56 @@ +ce_flags |= ZEND_ACC_READONLY_CLASS; + zend_class_implements(class_entry, 1, class_entry_JsonSerializable); + + zend_string *property_direction_class_Ecma_Intl_Locale_CharacterDirection = zend_string_init("Ecma\\Intl\\Locale\\CharacterDirection", sizeof("Ecma\\Intl\\Locale\\CharacterDirection")-1, 1); + zval property_direction_default_value; + ZVAL_UNDEF(&property_direction_default_value); + zend_string *property_direction_name = zend_string_init("direction", sizeof("direction") - 1, 1); + zend_declare_typed_property(class_entry, property_direction_name, &property_direction_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_direction_class_Ecma_Intl_Locale_CharacterDirection, 0, 0)); + zend_string_release(property_direction_name); + + return class_entry; +} diff --git a/src/php/classes/locale_week_day.c b/src/php/classes/locale_week_day.c index 04d994b..f36ffce 100644 --- a/src/php/classes/locale_week_day.c +++ b/src/php/classes/locale_week_day.c @@ -12,8 +12,12 @@ #include "php/classes/locale_week_day.h" +#include "php/classes/locale_week_day_arginfo.h" + zend_class_entry *ecma_ce_IntlLocaleWeekDay = NULL; -void registerEcmaIntlLocaleWeekDay() { +PHP_MINIT_FUNCTION(ecma_intl_locale_weekday) { ecma_ce_IntlLocaleWeekDay = register_class_Ecma_Intl_Locale_WeekDay(); + + return SUCCESS; } diff --git a/src/php/classes/locale_week_day.h b/src/php/classes/locale_week_day.h index cf5c4d1..ad110f2 100644 --- a/src/php/classes/locale_week_day.h +++ b/src/php/classes/locale_week_day.h @@ -17,6 +17,6 @@ extern zend_class_entry *ecma_ce_IntlLocaleWeekDay; -void registerEcmaIntlLocaleWeekDay(void); +PHP_MINIT_FUNCTION(ecma_intl_locale_weekday); #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_WEEK_DAY_H */ diff --git a/src/php/classes/locale_week_day.stub.php b/src/php/classes/locale_week_day.stub.php new file mode 100644 index 0000000..304d5d8 --- /dev/null +++ b/src/php/classes/locale_week_day.stub.php @@ -0,0 +1,35 @@ + zend_class_entry *ecma_ce_IntlLocaleWeekInfo = NULL; @@ -21,7 +23,7 @@ zend_object_handlers ecma_handlers_IntlLocaleWeekInfo; static void freeLocaleWeekInfoObj(zend_object *object); -void registerEcmaIntlLocaleWeekInfo() { +PHP_MINIT_FUNCTION(ecma_intl_locale_weekinfo) { ecma_ce_IntlLocaleWeekInfo = register_class_Ecma_Intl_Locale_WeekInfo(php_json_serializable_ce); ecma_ce_IntlLocaleWeekInfo->create_object = ecma_createIntlLocaleWeekInfo; @@ -32,8 +34,9 @@ void registerEcmaIntlLocaleWeekInfo() { ecma_handlers_IntlLocaleWeekInfo.offset = XtOffsetOf(ecma_IntlLocaleWeekInfo, std); ecma_handlers_IntlLocaleWeekInfo.free_obj = freeLocaleWeekInfoObj; -} + return SUCCESS; +} zend_object *ecma_createIntlLocaleWeekInfo(zend_class_entry *classEntry) { ecma_IntlLocaleWeekInfo *intlLocaleWeekInfo; diff --git a/src/php/classes/locale_week_info.h b/src/php/classes/locale_week_info.h index 2c0b428..b0ec0d0 100644 --- a/src/php/classes/locale_week_info.h +++ b/src/php/classes/locale_week_info.h @@ -30,7 +30,8 @@ ecma_IntlLocaleWeekInfoFromObj(zend_object *obj) { extern zend_class_entry *ecma_ce_IntlLocaleWeekInfo; extern zend_object_handlers ecma_handlers_IntlLocaleWeekInfo; -void registerEcmaIntlLocaleWeekInfo(void); zend_object *ecma_createIntlLocaleWeekInfo(zend_class_entry *classEntry); +PHP_MINIT_FUNCTION(ecma_intl_locale_weekinfo); + #endif /* ECMA_INTL_PHP_CLASSES_LOCALE_WEEK_INFO_H */ diff --git a/src/php/classes/locale_week_info.stub.php b/src/php/classes/locale_week_info.stub.php new file mode 100644 index 0000000..0db3984 --- /dev/null +++ b/src/php/classes/locale_week_info.stub.php @@ -0,0 +1,83 @@ + + */ + public readonly int $minimalDays; + + /** + * A list of week days that are considered part of the weekend + * for the locale. + * + * Please note, the number of weekend days in each locale may be + * different, and they may not be contiguous. + * + * @var WeekDay[] + */ + public readonly array $weekend; + + /** + * WeekInfo represents locale-specific information about the days of the + * week, for calendar purposes. + * + * @link https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getWeekInfo Intl Locale Info Proposal: getTextInfo() + * @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo Intl.Locale.prototype.getWeekInfo() + * @link https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Patterns_Week_Elements UTS 35: Week Elements + * + * @param WeekDay $firstDay The week day that is considered the _first_ day of the week. + * @param WeekDay[] $weekend A list of week days that are considered part of the weekend. + * @phpstan-param int<1, 7> $minimalDays The minimum days required in the first week of a month or year. + */ + public function __construct( + WeekDay $firstDay, + array $weekend, + int $minimalDays, + ) { + } + + /** + * Returns an object of WeekInfo properties and their values, suitable + * for serializing to JSON. + * + * @return object + */ + public function jsonSerialize(): object + { + } + } +} diff --git a/src/php/classes/locale_week_info_arginfo.h b/src/php/classes/locale_week_info_arginfo.h new file mode 100644 index 0000000..014f797 --- /dev/null +++ b/src/php/classes/locale_week_info_arginfo.h @@ -0,0 +1,53 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 3051c3b438167cf62f52ffb9330009339345353b */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale_WeekInfo___construct, 0, 0, 3) + ZEND_ARG_OBJ_INFO(0, firstDay, Ecma\\Intl\\Locale\\WeekDay, 0) + ZEND_ARG_TYPE_INFO(0, weekend, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, minimalDays, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_WeekInfo_jsonSerialize, 0, 0, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + + +ZEND_METHOD(Ecma_Intl_Locale_WeekInfo, __construct); +ZEND_METHOD(Ecma_Intl_Locale_WeekInfo, jsonSerialize); + + +static const zend_function_entry class_Ecma_Intl_Locale_WeekInfo_methods[] = { + ZEND_ME(Ecma_Intl_Locale_WeekInfo, __construct, arginfo_class_Ecma_Intl_Locale_WeekInfo___construct, ZEND_ACC_PUBLIC) + ZEND_ME(Ecma_Intl_Locale_WeekInfo, jsonSerialize, arginfo_class_Ecma_Intl_Locale_WeekInfo_jsonSerialize, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static zend_class_entry *register_class_Ecma_Intl_Locale_WeekInfo(zend_class_entry *class_entry_JsonSerializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl\\Locale", "WeekInfo", class_Ecma_Intl_Locale_WeekInfo_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_READONLY_CLASS; + zend_class_implements(class_entry, 1, class_entry_JsonSerializable); + + zend_string *property_firstDay_class_Ecma_Intl_Locale_WeekDay = zend_string_init("Ecma\\Intl\\Locale\\WeekDay", sizeof("Ecma\\Intl\\Locale\\WeekDay")-1, 1); + zval property_firstDay_default_value; + ZVAL_UNDEF(&property_firstDay_default_value); + zend_string *property_firstDay_name = zend_string_init("firstDay", sizeof("firstDay") - 1, 1); + zend_declare_typed_property(class_entry, property_firstDay_name, &property_firstDay_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_firstDay_class_Ecma_Intl_Locale_WeekDay, 0, 0)); + zend_string_release(property_firstDay_name); + + zval property_minimalDays_default_value; + ZVAL_UNDEF(&property_minimalDays_default_value); + zend_string *property_minimalDays_name = zend_string_init("minimalDays", sizeof("minimalDays") - 1, 1); + zend_declare_typed_property(class_entry, property_minimalDays_name, &property_minimalDays_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_string_release(property_minimalDays_name); + + zval property_weekend_default_value; + ZVAL_UNDEF(&property_weekend_default_value); + zend_string *property_weekend_name = zend_string_init("weekend", sizeof("weekend") - 1, 1); + zend_declare_typed_property(class_entry, property_weekend_name, &property_weekend_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); + zend_string_release(property_weekend_name); + + return class_entry; +} diff --git a/src/php/ecma_intl.c b/src/php/ecma_intl.c index a905d37..dd65468 100644 --- a/src/php/ecma_intl.c +++ b/src/php/ecma_intl.c @@ -31,7 +31,7 @@ zend_module_entry ecma_intl_module_entry = {STANDARD_MODULE_HEADER, "ecma_intl", NULL, - PHP_MINIT(ecma_intl), + PHP_MINIT(ecma_intl_all), NULL, PHP_RINIT(ecma_intl), NULL, @@ -46,15 +46,15 @@ ZEND_TSRMLS_CACHE_DEFINE() ZEND_GET_MODULE(ecma_intl) #endif -PHP_MINIT_FUNCTION(ecma_intl) { - registerEcmaIntl(); - registerEcmaIntlCategory(); - registerEcmaIntlLocale(); - registerEcmaIntlLocaleCharacterDirection(); - registerEcmaIntlLocaleOptions(); - registerEcmaIntlLocaleTextInfo(); - registerEcmaIntlLocaleWeekDay(); - registerEcmaIntlLocaleWeekInfo(); +PHP_MINIT_FUNCTION(ecma_intl_all) { + PHP_MINIT(ecma_intl)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_category)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale_characterdirection)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale_options)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale_textinfo)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale_weekday)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(ecma_intl_locale_weekinfo)(INIT_FUNC_ARGS_PASSTHRU); return SUCCESS; } diff --git a/src/php/ecma_intl.h b/src/php/ecma_intl.h index 6dba497..d834589 100644 --- a/src/php/ecma_intl.h +++ b/src/php/ecma_intl.h @@ -24,7 +24,7 @@ extern zend_module_entry ecma_intl_module_entry; ZEND_TSRMLS_CACHE_EXTERN() #endif -PHP_MINIT_FUNCTION(ecma_intl); +PHP_MINIT_FUNCTION(ecma_intl_all); PHP_RINIT_FUNCTION(ecma_intl); PHP_MINFO_FUNCTION(ecma_intl); diff --git a/src/php/ecma_intl_arginfo.h b/src/php/ecma_intl_arginfo.h deleted file mode 100644 index 704f7b1..0000000 --- a/src/php/ecma_intl_arginfo.h +++ /dev/null @@ -1,541 +0,0 @@ -/* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7ddfa21a419a4884073bf5764537976a096ec5d3 */ - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_getCanonicalLocales, 0, 1, IS_ARRAY, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, locales, Traversable|Stringable, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, NULL) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_supportedValuesOf, 0, 1, IS_ARRAY, 0) - ZEND_ARG_OBJ_INFO(0, category, Ecma\\Intl\\Category, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl___construct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale___construct, 0, 0, 1) - ZEND_ARG_OBJ_TYPE_MASK(0, tag, Stringable, MAY_BE_STRING, NULL) - ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, options, Ecma\\Intl\\Locale\\Options, 1, "null") -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_getCalendars, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_getCollations arginfo_class_Ecma_Intl_Locale_getCalendars - -#define arginfo_class_Ecma_Intl_Locale_getCurrencies arginfo_class_Ecma_Intl_Locale_getCalendars - -#define arginfo_class_Ecma_Intl_Locale_getHourCycles arginfo_class_Ecma_Intl_Locale_getCalendars - -#define arginfo_class_Ecma_Intl_Locale_getNumberingSystems arginfo_class_Ecma_Intl_Locale_getCalendars - -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_getTextInfo, 0, 0, Ecma\\Intl\\Locale\\TextInfo, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_getTimeZones, 0, 0, IS_ARRAY, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_getWeekInfo, 0, 0, Ecma\\Intl\\Locale\\WeekInfo, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_jsonSerialize, 0, 0, IS_OBJECT, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_Ecma_Intl_Locale_maximize, 0, 0, Ecma\\Intl\\Locale, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_minimize arginfo_class_Ecma_Intl_Locale_maximize - -#define arginfo_class_Ecma_Intl_Locale_toString arginfo_class_Ecma_Intl_Locale___toString - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options___construct, 0, 0, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, calendar, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, caseFirst, Stringable, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, collation, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, hourCycle, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, language, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, numberingSystem, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, numeric, _IS_BOOL, 1, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, region, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") - ZEND_ARG_OBJ_TYPE_MASK(0, script, Stringable, MAY_BE_STRING|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_Options_jsonSerialize arginfo_class_Ecma_Intl_Locale_jsonSerialize - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Ecma_Intl_Locale_Options_current, 0, 0, MAY_BE_STRING|MAY_BE_BOOL) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_next, 0, 0, IS_VOID, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_Options_key arginfo_class_Ecma_Intl_Locale___toString - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Ecma_Intl_Locale_Options_valid, 0, 0, _IS_BOOL, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_Options_rewind arginfo_class_Ecma_Intl_Locale_Options_next - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale_TextInfo___construct, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, direction, Ecma\\Intl\\Locale\\CharacterDirection, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_TextInfo_jsonSerialize arginfo_class_Ecma_Intl_Locale_jsonSerialize - -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Ecma_Intl_Locale_WeekInfo___construct, 0, 0, 3) - ZEND_ARG_OBJ_INFO(0, firstDay, Ecma\\Intl\\Locale\\WeekDay, 0) - ZEND_ARG_TYPE_INFO(0, weekend, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, minimalDays, IS_LONG, 0) -ZEND_END_ARG_INFO() - -#define arginfo_class_Ecma_Intl_Locale_WeekInfo_jsonSerialize arginfo_class_Ecma_Intl_Locale_jsonSerialize - - -ZEND_METHOD(Ecma_Intl, getCanonicalLocales); -ZEND_METHOD(Ecma_Intl, supportedValuesOf); -ZEND_METHOD(Ecma_Intl, __construct); -ZEND_METHOD(Ecma_Intl_Locale, __construct); -ZEND_METHOD(Ecma_Intl_Locale, toString); -ZEND_METHOD(Ecma_Intl_Locale, getCalendars); -ZEND_METHOD(Ecma_Intl_Locale, getCollations); -ZEND_METHOD(Ecma_Intl_Locale, getCurrencies); -ZEND_METHOD(Ecma_Intl_Locale, getHourCycles); -ZEND_METHOD(Ecma_Intl_Locale, getNumberingSystems); -ZEND_METHOD(Ecma_Intl_Locale, getTextInfo); -ZEND_METHOD(Ecma_Intl_Locale, getTimeZones); -ZEND_METHOD(Ecma_Intl_Locale, getWeekInfo); -ZEND_METHOD(Ecma_Intl_Locale, jsonSerialize); -ZEND_METHOD(Ecma_Intl_Locale, maximize); -ZEND_METHOD(Ecma_Intl_Locale, minimize); -ZEND_METHOD(Ecma_Intl_Locale_Options, __construct); -ZEND_METHOD(Ecma_Intl_Locale_Options, jsonSerialize); -ZEND_METHOD(Ecma_Intl_Locale_Options, current); -ZEND_METHOD(Ecma_Intl_Locale_Options, next); -ZEND_METHOD(Ecma_Intl_Locale_Options, key); -ZEND_METHOD(Ecma_Intl_Locale_Options, valid); -ZEND_METHOD(Ecma_Intl_Locale_Options, rewind); -ZEND_METHOD(Ecma_Intl_Locale_TextInfo, __construct); -ZEND_METHOD(Ecma_Intl_Locale_TextInfo, jsonSerialize); -ZEND_METHOD(Ecma_Intl_Locale_WeekInfo, __construct); -ZEND_METHOD(Ecma_Intl_Locale_WeekInfo, jsonSerialize); - - -static const zend_function_entry class_Ecma_Intl_methods[] = { - ZEND_ME(Ecma_Intl, getCanonicalLocales, arginfo_class_Ecma_Intl_getCanonicalLocales, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_ME(Ecma_Intl, supportedValuesOf, arginfo_class_Ecma_Intl_supportedValuesOf, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - ZEND_ME(Ecma_Intl, __construct, arginfo_class_Ecma_Intl___construct, ZEND_ACC_PRIVATE) - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Category_methods[] = { - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_methods[] = { - ZEND_ME(Ecma_Intl_Locale, __construct, arginfo_class_Ecma_Intl_Locale___construct, ZEND_ACC_PUBLIC) - ZEND_MALIAS(Ecma_Intl_Locale, __toString, toString, arginfo_class_Ecma_Intl_Locale___toString, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getCalendars, arginfo_class_Ecma_Intl_Locale_getCalendars, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getCollations, arginfo_class_Ecma_Intl_Locale_getCollations, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getCurrencies, arginfo_class_Ecma_Intl_Locale_getCurrencies, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getHourCycles, arginfo_class_Ecma_Intl_Locale_getHourCycles, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getNumberingSystems, arginfo_class_Ecma_Intl_Locale_getNumberingSystems, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getTextInfo, arginfo_class_Ecma_Intl_Locale_getTextInfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getTimeZones, arginfo_class_Ecma_Intl_Locale_getTimeZones, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, getWeekInfo, arginfo_class_Ecma_Intl_Locale_getWeekInfo, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, jsonSerialize, arginfo_class_Ecma_Intl_Locale_jsonSerialize, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, maximize, arginfo_class_Ecma_Intl_Locale_maximize, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, minimize, arginfo_class_Ecma_Intl_Locale_minimize, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale, toString, arginfo_class_Ecma_Intl_Locale_toString, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_CharacterDirection_methods[] = { - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_Options_methods[] = { - ZEND_ME(Ecma_Intl_Locale_Options, __construct, arginfo_class_Ecma_Intl_Locale_Options___construct, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, jsonSerialize, arginfo_class_Ecma_Intl_Locale_Options_jsonSerialize, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, current, arginfo_class_Ecma_Intl_Locale_Options_current, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, next, arginfo_class_Ecma_Intl_Locale_Options_next, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, key, arginfo_class_Ecma_Intl_Locale_Options_key, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, valid, arginfo_class_Ecma_Intl_Locale_Options_valid, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_Options, rewind, arginfo_class_Ecma_Intl_Locale_Options_rewind, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_TextInfo_methods[] = { - ZEND_ME(Ecma_Intl_Locale_TextInfo, __construct, arginfo_class_Ecma_Intl_Locale_TextInfo___construct, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_TextInfo, jsonSerialize, arginfo_class_Ecma_Intl_Locale_TextInfo_jsonSerialize, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_WeekDay_methods[] = { - ZEND_FE_END -}; - - -static const zend_function_entry class_Ecma_Intl_Locale_WeekInfo_methods[] = { - ZEND_ME(Ecma_Intl_Locale_WeekInfo, __construct, arginfo_class_Ecma_Intl_Locale_WeekInfo___construct, ZEND_ACC_PUBLIC) - ZEND_ME(Ecma_Intl_Locale_WeekInfo, jsonSerialize, arginfo_class_Ecma_Intl_Locale_WeekInfo_jsonSerialize, ZEND_ACC_PUBLIC) - ZEND_FE_END -}; - -static zend_class_entry *register_class_Ecma_Intl(void) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "Ecma", "Intl", class_Ecma_Intl_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_FINAL; - - zval const_ICU_VERSION_value; - zend_string *const_ICU_VERSION_value_str = zend_string_init(U_ICU_VERSION, strlen(U_ICU_VERSION), 1); - ZVAL_STR(&const_ICU_VERSION_value, const_ICU_VERSION_value_str); - zend_string *const_ICU_VERSION_name = zend_string_init_interned("ICU_VERSION", sizeof("ICU_VERSION") - 1, 1); - zend_declare_class_constant_ex(class_entry, const_ICU_VERSION_name, &const_ICU_VERSION_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(const_ICU_VERSION_name); - - zval const_UNICODE_VERSION_value; - zend_string *const_UNICODE_VERSION_value_str = zend_string_init(U_UNICODE_VERSION, strlen(U_UNICODE_VERSION), 1); - ZVAL_STR(&const_UNICODE_VERSION_value, const_UNICODE_VERSION_value_str); - zend_string *const_UNICODE_VERSION_name = zend_string_init_interned("UNICODE_VERSION", sizeof("UNICODE_VERSION") - 1, 1); - zend_declare_class_constant_ex(class_entry, const_UNICODE_VERSION_name, &const_UNICODE_VERSION_value, ZEND_ACC_PUBLIC, NULL); - zend_string_release(const_UNICODE_VERSION_name); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Category(void) -{ - zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Category", IS_STRING, class_Ecma_Intl_Category_methods); - - zval enum_case_Calendar_value; - zend_string *enum_case_Calendar_value_str = zend_string_init("calendar", strlen("calendar"), 1); - ZVAL_STR(&enum_case_Calendar_value, enum_case_Calendar_value_str); - zend_enum_add_case_cstr(class_entry, "Calendar", &enum_case_Calendar_value); - - zval enum_case_Collation_value; - zend_string *enum_case_Collation_value_str = zend_string_init("collation", strlen("collation"), 1); - ZVAL_STR(&enum_case_Collation_value, enum_case_Collation_value_str); - zend_enum_add_case_cstr(class_entry, "Collation", &enum_case_Collation_value); - - zval enum_case_Currency_value; - zend_string *enum_case_Currency_value_str = zend_string_init("currency", strlen("currency"), 1); - ZVAL_STR(&enum_case_Currency_value, enum_case_Currency_value_str); - zend_enum_add_case_cstr(class_entry, "Currency", &enum_case_Currency_value); - - zval enum_case_NumberingSystem_value; - zend_string *enum_case_NumberingSystem_value_str = zend_string_init("numberingSystem", strlen("numberingSystem"), 1); - ZVAL_STR(&enum_case_NumberingSystem_value, enum_case_NumberingSystem_value_str); - zend_enum_add_case_cstr(class_entry, "NumberingSystem", &enum_case_NumberingSystem_value); - - zval enum_case_TimeZone_value; - zend_string *enum_case_TimeZone_value_str = zend_string_init("timeZone", strlen("timeZone"), 1); - ZVAL_STR(&enum_case_TimeZone_value, enum_case_TimeZone_value_str); - zend_enum_add_case_cstr(class_entry, "TimeZone", &enum_case_TimeZone_value); - - zval enum_case_Unit_value; - zend_string *enum_case_Unit_value_str = zend_string_init("unit", strlen("unit"), 1); - ZVAL_STR(&enum_case_Unit_value, enum_case_Unit_value_str); - zend_enum_add_case_cstr(class_entry, "Unit", &enum_case_Unit_value); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_Stringable) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl", "Locale", class_Ecma_Intl_Locale_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_READONLY_CLASS; - zend_class_implements(class_entry, 2, class_entry_JsonSerializable, class_entry_Stringable); - - zval property_baseName_default_value; - ZVAL_UNDEF(&property_baseName_default_value); - zend_string *property_baseName_name = zend_string_init("baseName", sizeof("baseName") - 1, 1); - zend_declare_typed_property(class_entry, property_baseName_name, &property_baseName_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_baseName_name); - - zval property_calendar_default_value; - ZVAL_UNDEF(&property_calendar_default_value); - zend_string *property_calendar_name = zend_string_init("calendar", sizeof("calendar") - 1, 1); - zend_declare_typed_property(class_entry, property_calendar_name, &property_calendar_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_calendar_name); - - zval property_calendars_default_value; - ZVAL_UNDEF(&property_calendars_default_value); - zend_string *property_calendars_name = zend_string_init("calendars", sizeof("calendars") - 1, 1); - zend_declare_typed_property(class_entry, property_calendars_name, &property_calendars_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_calendars_name); - - zval property_caseFirst_default_value; - ZVAL_UNDEF(&property_caseFirst_default_value); - zend_string *property_caseFirst_name = zend_string_init("caseFirst", sizeof("caseFirst") - 1, 1); - zend_declare_typed_property(class_entry, property_caseFirst_name, &property_caseFirst_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_caseFirst_name); - - zval property_collation_default_value; - ZVAL_UNDEF(&property_collation_default_value); - zend_string *property_collation_name = zend_string_init("collation", sizeof("collation") - 1, 1); - zend_declare_typed_property(class_entry, property_collation_name, &property_collation_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_collation_name); - - zval property_collations_default_value; - ZVAL_UNDEF(&property_collations_default_value); - zend_string *property_collations_name = zend_string_init("collations", sizeof("collations") - 1, 1); - zend_declare_typed_property(class_entry, property_collations_name, &property_collations_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_collations_name); - - zval property_currencies_default_value; - ZVAL_UNDEF(&property_currencies_default_value); - zend_string *property_currencies_name = zend_string_init("currencies", sizeof("currencies") - 1, 1); - zend_declare_typed_property(class_entry, property_currencies_name, &property_currencies_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_currencies_name); - - zval property_hourCycle_default_value; - ZVAL_UNDEF(&property_hourCycle_default_value); - zend_string *property_hourCycle_name = zend_string_init("hourCycle", sizeof("hourCycle") - 1, 1); - zend_declare_typed_property(class_entry, property_hourCycle_name, &property_hourCycle_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_hourCycle_name); - - zval property_hourCycles_default_value; - ZVAL_UNDEF(&property_hourCycles_default_value); - zend_string *property_hourCycles_name = zend_string_init("hourCycles", sizeof("hourCycles") - 1, 1); - zend_declare_typed_property(class_entry, property_hourCycles_name, &property_hourCycles_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_hourCycles_name); - - zval property_language_default_value; - ZVAL_UNDEF(&property_language_default_value); - zend_string *property_language_name = zend_string_init("language", sizeof("language") - 1, 1); - zend_declare_typed_property(class_entry, property_language_name, &property_language_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_language_name); - - zval property_numberingSystem_default_value; - ZVAL_UNDEF(&property_numberingSystem_default_value); - zend_string *property_numberingSystem_name = zend_string_init("numberingSystem", sizeof("numberingSystem") - 1, 1); - zend_declare_typed_property(class_entry, property_numberingSystem_name, &property_numberingSystem_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_numberingSystem_name); - - zval property_numberingSystems_default_value; - ZVAL_UNDEF(&property_numberingSystems_default_value); - zend_string *property_numberingSystems_name = zend_string_init("numberingSystems", sizeof("numberingSystems") - 1, 1); - zend_declare_typed_property(class_entry, property_numberingSystems_name, &property_numberingSystems_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_numberingSystems_name); - - zval property_numeric_default_value; - ZVAL_UNDEF(&property_numeric_default_value); - zend_string *property_numeric_name = zend_string_init("numeric", sizeof("numeric") - 1, 1); - zend_declare_typed_property(class_entry, property_numeric_name, &property_numeric_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL)); - zend_string_release(property_numeric_name); - - zval property_region_default_value; - ZVAL_UNDEF(&property_region_default_value); - zend_string *property_region_name = zend_string_init("region", sizeof("region") - 1, 1); - zend_declare_typed_property(class_entry, property_region_name, &property_region_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_region_name); - - zval property_script_default_value; - ZVAL_UNDEF(&property_script_default_value); - zend_string *property_script_name = zend_string_init("script", sizeof("script") - 1, 1); - zend_declare_typed_property(class_entry, property_script_name, &property_script_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_script_name); - - zend_string *property_textInfo_class_Ecma_Intl_Locale_TextInfo = zend_string_init("Ecma\\Intl\\Locale\\TextInfo", sizeof("Ecma\\Intl\\Locale\\TextInfo")-1, 1); - zval property_textInfo_default_value; - ZVAL_UNDEF(&property_textInfo_default_value); - zend_string *property_textInfo_name = zend_string_init("textInfo", sizeof("textInfo") - 1, 1); - zend_declare_typed_property(class_entry, property_textInfo_name, &property_textInfo_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_textInfo_class_Ecma_Intl_Locale_TextInfo, 0, 0)); - zend_string_release(property_textInfo_name); - - zval property_timeZones_default_value; - ZVAL_UNDEF(&property_timeZones_default_value); - zend_string *property_timeZones_name = zend_string_init("timeZones", sizeof("timeZones") - 1, 1); - zend_declare_typed_property(class_entry, property_timeZones_name, &property_timeZones_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL)); - zend_string_release(property_timeZones_name); - - zend_string *property_weekInfo_class_Ecma_Intl_Locale_WeekInfo = zend_string_init("Ecma\\Intl\\Locale\\WeekInfo", sizeof("Ecma\\Intl\\Locale\\WeekInfo")-1, 1); - zval property_weekInfo_default_value; - ZVAL_UNDEF(&property_weekInfo_default_value); - zend_string *property_weekInfo_name = zend_string_init("weekInfo", sizeof("weekInfo") - 1, 1); - zend_declare_typed_property(class_entry, property_weekInfo_name, &property_weekInfo_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_weekInfo_class_Ecma_Intl_Locale_WeekInfo, 0, 0)); - zend_string_release(property_weekInfo_name); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale_CharacterDirection(void) -{ - zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Locale\\CharacterDirection", IS_STRING, class_Ecma_Intl_Locale_CharacterDirection_methods); - - zval enum_case_LeftToRight_value; - zend_string *enum_case_LeftToRight_value_str = zend_string_init("ltr", strlen("ltr"), 1); - ZVAL_STR(&enum_case_LeftToRight_value, enum_case_LeftToRight_value_str); - zend_enum_add_case_cstr(class_entry, "LeftToRight", &enum_case_LeftToRight_value); - - zval enum_case_RightToLeft_value; - zend_string *enum_case_RightToLeft_value_str = zend_string_init("rtl", strlen("rtl"), 1); - ZVAL_STR(&enum_case_RightToLeft_value, enum_case_RightToLeft_value_str); - zend_enum_add_case_cstr(class_entry, "RightToLeft", &enum_case_RightToLeft_value); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale_Options(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_JsonSerializable) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl\\Locale", "Options", class_Ecma_Intl_Locale_Options_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_READONLY_CLASS; - zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_JsonSerializable); - - zval property_calendar_default_value; - ZVAL_UNDEF(&property_calendar_default_value); - zend_string *property_calendar_name = zend_string_init("calendar", sizeof("calendar") - 1, 1); - zend_declare_typed_property(class_entry, property_calendar_name, &property_calendar_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_calendar_name); - - zval property_caseFirst_default_value; - ZVAL_UNDEF(&property_caseFirst_default_value); - zend_string *property_caseFirst_name = zend_string_init("caseFirst", sizeof("caseFirst") - 1, 1); - zend_declare_typed_property(class_entry, property_caseFirst_name, &property_caseFirst_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_caseFirst_name); - - zval property_collation_default_value; - ZVAL_UNDEF(&property_collation_default_value); - zend_string *property_collation_name = zend_string_init("collation", sizeof("collation") - 1, 1); - zend_declare_typed_property(class_entry, property_collation_name, &property_collation_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_collation_name); - - zval property_hourCycle_default_value; - ZVAL_UNDEF(&property_hourCycle_default_value); - zend_string *property_hourCycle_name = zend_string_init("hourCycle", sizeof("hourCycle") - 1, 1); - zend_declare_typed_property(class_entry, property_hourCycle_name, &property_hourCycle_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_hourCycle_name); - - zval property_language_default_value; - ZVAL_UNDEF(&property_language_default_value); - zend_string *property_language_name = zend_string_init("language", sizeof("language") - 1, 1); - zend_declare_typed_property(class_entry, property_language_name, &property_language_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_language_name); - - zval property_numberingSystem_default_value; - ZVAL_UNDEF(&property_numberingSystem_default_value); - zend_string *property_numberingSystem_name = zend_string_init("numberingSystem", sizeof("numberingSystem") - 1, 1); - zend_declare_typed_property(class_entry, property_numberingSystem_name, &property_numberingSystem_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_numberingSystem_name); - - zval property_numeric_default_value; - ZVAL_UNDEF(&property_numeric_default_value); - zend_string *property_numeric_name = zend_string_init("numeric", sizeof("numeric") - 1, 1); - zend_declare_typed_property(class_entry, property_numeric_name, &property_numeric_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL|MAY_BE_NULL)); - zend_string_release(property_numeric_name); - - zval property_region_default_value; - ZVAL_UNDEF(&property_region_default_value); - zend_string *property_region_name = zend_string_init("region", sizeof("region") - 1, 1); - zend_declare_typed_property(class_entry, property_region_name, &property_region_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_region_name); - - zval property_script_default_value; - ZVAL_UNDEF(&property_script_default_value); - zend_string *property_script_name = zend_string_init("script", sizeof("script") - 1, 1); - zend_declare_typed_property(class_entry, property_script_name, &property_script_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL)); - zend_string_release(property_script_name); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale_TextInfo(zend_class_entry *class_entry_JsonSerializable) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl\\Locale", "TextInfo", class_Ecma_Intl_Locale_TextInfo_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_READONLY_CLASS; - zend_class_implements(class_entry, 1, class_entry_JsonSerializable); - - zend_string *property_direction_class_Ecma_Intl_Locale_CharacterDirection = zend_string_init("Ecma\\Intl\\Locale\\CharacterDirection", sizeof("Ecma\\Intl\\Locale\\CharacterDirection")-1, 1); - zval property_direction_default_value; - ZVAL_UNDEF(&property_direction_default_value); - zend_string *property_direction_name = zend_string_init("direction", sizeof("direction") - 1, 1); - zend_declare_typed_property(class_entry, property_direction_name, &property_direction_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_direction_class_Ecma_Intl_Locale_CharacterDirection, 0, 0)); - zend_string_release(property_direction_name); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale_WeekDay(void) -{ - zend_class_entry *class_entry = zend_register_internal_enum("Ecma\\Intl\\Locale\\WeekDay", IS_LONG, class_Ecma_Intl_Locale_WeekDay_methods); - - zval enum_case_Monday_value; - ZVAL_LONG(&enum_case_Monday_value, 1); - zend_enum_add_case_cstr(class_entry, "Monday", &enum_case_Monday_value); - - zval enum_case_Tuesday_value; - ZVAL_LONG(&enum_case_Tuesday_value, 2); - zend_enum_add_case_cstr(class_entry, "Tuesday", &enum_case_Tuesday_value); - - zval enum_case_Wednesday_value; - ZVAL_LONG(&enum_case_Wednesday_value, 3); - zend_enum_add_case_cstr(class_entry, "Wednesday", &enum_case_Wednesday_value); - - zval enum_case_Thursday_value; - ZVAL_LONG(&enum_case_Thursday_value, 4); - zend_enum_add_case_cstr(class_entry, "Thursday", &enum_case_Thursday_value); - - zval enum_case_Friday_value; - ZVAL_LONG(&enum_case_Friday_value, 5); - zend_enum_add_case_cstr(class_entry, "Friday", &enum_case_Friday_value); - - zval enum_case_Saturday_value; - ZVAL_LONG(&enum_case_Saturday_value, 6); - zend_enum_add_case_cstr(class_entry, "Saturday", &enum_case_Saturday_value); - - zval enum_case_Sunday_value; - ZVAL_LONG(&enum_case_Sunday_value, 7); - zend_enum_add_case_cstr(class_entry, "Sunday", &enum_case_Sunday_value); - - return class_entry; -} - -static zend_class_entry *register_class_Ecma_Intl_Locale_WeekInfo(zend_class_entry *class_entry_JsonSerializable) -{ - zend_class_entry ce, *class_entry; - - INIT_NS_CLASS_ENTRY(ce, "Ecma\\Intl\\Locale", "WeekInfo", class_Ecma_Intl_Locale_WeekInfo_methods); - class_entry = zend_register_internal_class_ex(&ce, NULL); - class_entry->ce_flags |= ZEND_ACC_READONLY_CLASS; - zend_class_implements(class_entry, 1, class_entry_JsonSerializable); - - zend_string *property_firstDay_class_Ecma_Intl_Locale_WeekDay = zend_string_init("Ecma\\Intl\\Locale\\WeekDay", sizeof("Ecma\\Intl\\Locale\\WeekDay")-1, 1); - zval property_firstDay_default_value; - ZVAL_UNDEF(&property_firstDay_default_value); - zend_string *property_firstDay_name = zend_string_init("firstDay", sizeof("firstDay") - 1, 1); - zend_declare_typed_property(class_entry, property_firstDay_name, &property_firstDay_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property_firstDay_class_Ecma_Intl_Locale_WeekDay, 0, 0)); - zend_string_release(property_firstDay_name); - - zval property_minimalDays_default_value; - ZVAL_UNDEF(&property_minimalDays_default_value); - zend_string *property_minimalDays_name = zend_string_init("minimalDays", sizeof("minimalDays") - 1, 1); - zend_declare_typed_property(class_entry, property_minimalDays_name, &property_minimalDays_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(property_minimalDays_name); - - zval property_weekend_default_value; - ZVAL_UNDEF(&property_weekend_default_value); - zend_string *property_weekend_name = zend_string_init("weekend", sizeof("weekend") - 1, 1); - zend_declare_typed_property(class_entry, property_weekend_name, &property_weekend_default_value, ZEND_ACC_PUBLIC|ZEND_ACC_READONLY, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY)); - zend_string_release(property_weekend_name); - - return class_entry; -} diff --git a/src/php/php_common.h b/src/php/php_common.h index d6feed2..14e77a3 100644 --- a/src/php/php_common.h +++ b/src/php/php_common.h @@ -22,8 +22,6 @@ #include #include -#include "php/ecma_intl_arginfo.h" - static inline bool isArray(zval *arg) { return EXPECTED(Z_TYPE_P(arg) == IS_ARRAY); }