diff options
| author | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-12 14:03:43 +0200 |
|---|---|---|
| committer | Máté Kocsis <kocsismate@woohoolabs.com> | 2020-04-14 13:39:00 +0200 |
| commit | f00bcfbb7dfe759ffab5abd05e3171fdeeb2f02e (patch) | |
| tree | c89922e5fd24312e3bdcc0af96ab1dfe1cf4fd05 /ext/intl/timezone | |
| parent | ae1364c35006bfcd0d7feeecddb7499000eba1b5 (diff) | |
| download | php-git-f00bcfbb7dfe759ffab5abd05e3171fdeeb2f02e.tar.gz | |
Generate method entries for ext/intl
Closes GH-5370
Diffstat (limited to 'ext/intl/timezone')
| -rw-r--r-- | ext/intl/timezone/timezone.stub.php | 118 | ||||
| -rw-r--r-- | ext/intl/timezone/timezone_arginfo.h | 65 | ||||
| -rw-r--r-- | ext/intl/timezone/timezone_class.cpp | 39 | ||||
| -rw-r--r-- | ext/intl/timezone/timezone_methods.h | 71 |
4 files changed, 161 insertions, 132 deletions
diff --git a/ext/intl/timezone/timezone.stub.php b/ext/intl/timezone/timezone.stub.php index fad55faeee..d34170a281 100644 --- a/ext/intl/timezone/timezone.stub.php +++ b/ext/intl/timezone/timezone.stub.php @@ -1,82 +1,154 @@ <?php +/** @generate-function-entries */ + class IntlTimeZone { private function __construct() {} - /** @return int|false */ + /** + * @return int|false + * @alias intltz_count_equivalent_ids + */ public static function countEquivalentIDs(string $zoneId) {} - /** @return IntlTimeZone */ + /** + * @return IntlTimeZone + * @alias intltz_create_default + */ public static function createDefault() {} /** * @param IntlTimeZone|string|int|double|null $countryOrRawOffset * @return IntlIterator|false + * @alias intltz_create_enumeration */ public static function createEnumeration($countryOrRawOffset = null) {} - /** @return IntlTimeZone|null */ + /** + * @return IntlTimeZone|null + * @alias intltz_create_time_zone + */ public static function createTimeZone(string $zoneId) {} - /** @return IntlIterator|false */ + /** + * @return IntlIterator|false + * @alias intltz_create_time_zone_id_enumeration + */ public static function createTimeZoneIDEnumeration(int $zoneType, ?string $region = null, ?int $rawOffset = null) {} - /** @return IntlTimeZone|null */ + /** + * @return IntlTimeZone|null + * @alias intltz_from_date_time_zone + */ public static function fromDateTimeZone(DateTimeZone $zone) {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_canonical_id + */ public static function getCanonicalID(string $zoneId, &$isSystemID = null) {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_display_name + */ public function getDisplayName(bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null) {} - /** @return int */ + /** + * @return int + * @alias intltz_get_dst_savings + */ public function getDSTSavings() {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_equivalent_id + */ public static function getEquivalentID(string $zoneId, int $index) {} - /** @return int|false */ + /** + * @return int|false + * @alias intltz_get_error_code + */ public function getErrorCode() {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_error_message + */ public function getErrorMessage() {} - /** @return IntlTimeZone */ + /** + * @return IntlTimeZone + * @alias intltz_get_gmt + */ public static function getGMT() {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_id + */ public function getID() {} - /** @return bool */ + /** + * @return bool + * @alias intltz_get_offset + */ public function getOffset(float $date, bool $local, &$rawOffset, &$dstOffset) {} - /** @return int */ + /** + * @return int + * @alias intltz_get_raw_offset + */ public function getRawOffset() {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_region + */ public static function getRegion(string $zoneId) {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_tz_data_version + */ public static function getTZDataVersion() {} - /** @return IntlTimeZone */ + /** + * @return IntlTimeZone + * @alias intltz_get_unknown + */ public static function getUnknown() {} #if U_ICU_VERSION_MAJOR_NUM >= 52 - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_windows_id + */ public static function getWindowsID(string $timezone) {} - /** @return string|false */ + /** + * @return string|false + * @alias intltz_get_id_for_windows_id + */ public static function getIDForWindowsID(string $timezone, string $region = UNKNOWN) {} #endif - /** @return bool */ + /** + * @return bool + * @alias intltz_has_same_rules + */ public function hasSameRules(IntlTimeZone $otherTimeZone) {} - /** @return DateTimeZone|false */ + /** + * @return DateTimeZone|false + * @alias intltz_to_date_time_zone + */ public function toDateTimeZone() {} - /** @return bool */ + /** + * @return bool + * @alias intltz_use_daylight_time + */ public function useDaylightTime() {} } diff --git a/ext/intl/timezone/timezone_arginfo.h b/ext/intl/timezone/timezone_arginfo.h index a379891dae..e6fdb2feaa 100644 --- a/ext/intl/timezone/timezone_arginfo.h +++ b/ext/intl/timezone/timezone_arginfo.h @@ -86,3 +86,68 @@ ZEND_END_ARG_INFO() #define arginfo_class_IntlTimeZone_toDateTimeZone arginfo_class_IntlTimeZone___construct #define arginfo_class_IntlTimeZone_useDaylightTime arginfo_class_IntlTimeZone___construct + + +ZEND_METHOD(IntlTimeZone, __construct); +ZEND_FUNCTION(intltz_count_equivalent_ids); +ZEND_FUNCTION(intltz_create_default); +ZEND_FUNCTION(intltz_create_enumeration); +ZEND_FUNCTION(intltz_create_time_zone); +ZEND_FUNCTION(intltz_create_time_zone_id_enumeration); +ZEND_FUNCTION(intltz_from_date_time_zone); +ZEND_FUNCTION(intltz_get_canonical_id); +ZEND_FUNCTION(intltz_get_display_name); +ZEND_FUNCTION(intltz_get_dst_savings); +ZEND_FUNCTION(intltz_get_equivalent_id); +ZEND_FUNCTION(intltz_get_error_code); +ZEND_FUNCTION(intltz_get_error_message); +ZEND_FUNCTION(intltz_get_gmt); +ZEND_FUNCTION(intltz_get_id); +ZEND_FUNCTION(intltz_get_offset); +ZEND_FUNCTION(intltz_get_raw_offset); +ZEND_FUNCTION(intltz_get_region); +ZEND_FUNCTION(intltz_get_tz_data_version); +ZEND_FUNCTION(intltz_get_unknown); +#if U_ICU_VERSION_MAJOR_NUM >= 52 +ZEND_FUNCTION(intltz_get_windows_id); +#endif +#if U_ICU_VERSION_MAJOR_NUM >= 52 +ZEND_FUNCTION(intltz_get_id_for_windows_id); +#endif +ZEND_FUNCTION(intltz_has_same_rules); +ZEND_FUNCTION(intltz_to_date_time_zone); +ZEND_FUNCTION(intltz_use_daylight_time); + + +static const zend_function_entry class_IntlTimeZone_methods[] = { + ZEND_ME(IntlTimeZone, __construct, arginfo_class_IntlTimeZone___construct, ZEND_ACC_PRIVATE) + ZEND_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, arginfo_class_IntlTimeZone_countEquivalentIDs, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createDefault, intltz_create_default, arginfo_class_IntlTimeZone_createDefault, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createEnumeration, intltz_create_enumeration, arginfo_class_IntlTimeZone_createEnumeration, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createTimeZone, intltz_create_time_zone, arginfo_class_IntlTimeZone_createTimeZone, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, arginfo_class_IntlTimeZone_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, arginfo_class_IntlTimeZone_fromDateTimeZone, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, arginfo_class_IntlTimeZone_getCanonicalID, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getDisplayName, intltz_get_display_name, arginfo_class_IntlTimeZone_getDisplayName, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, arginfo_class_IntlTimeZone_getDSTSavings, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, arginfo_class_IntlTimeZone_getEquivalentID, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getErrorCode, intltz_get_error_code, arginfo_class_IntlTimeZone_getErrorCode, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getErrorMessage, intltz_get_error_message, arginfo_class_IntlTimeZone_getErrorMessage, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getGMT, intltz_get_gmt, arginfo_class_IntlTimeZone_getGMT, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getID, intltz_get_id, arginfo_class_IntlTimeZone_getID, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getOffset, intltz_get_offset, arginfo_class_IntlTimeZone_getOffset, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getRawOffset, intltz_get_raw_offset, arginfo_class_IntlTimeZone_getRawOffset, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getRegion, intltz_get_region, arginfo_class_IntlTimeZone_getRegion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, arginfo_class_IntlTimeZone_getTZDataVersion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getUnknown, intltz_get_unknown, arginfo_class_IntlTimeZone_getUnknown, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#if U_ICU_VERSION_MAJOR_NUM >= 52 + ZEND_ME_MAPPING(getWindowsID, intltz_get_windows_id, arginfo_class_IntlTimeZone_getWindowsID, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#endif +#if U_ICU_VERSION_MAJOR_NUM >= 52 + ZEND_ME_MAPPING(getIDForWindowsID, intltz_get_id_for_windows_id, arginfo_class_IntlTimeZone_getIDForWindowsID, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#endif + ZEND_ME_MAPPING(hasSameRules, intltz_has_same_rules, arginfo_class_IntlTimeZone_hasSameRules, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, arginfo_class_IntlTimeZone_toDateTimeZone, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, arginfo_class_IntlTimeZone_useDaylightTime, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 11a9177320..b3d447f5d5 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -29,7 +29,6 @@ extern "C" { #include "../intl_convert.h" #define USE_TIMEZONE_POINTER 1 #include "timezone_class.h" -#include "timezone_methods.h" #include "timezone_arginfo.h" #include <zend_exceptions.h> #include <zend_interfaces.h> @@ -391,42 +390,6 @@ static zend_object *TimeZone_object_create(zend_class_entry *ce) } /* }}} */ -/* {{{ TimeZone_class_functions - * Every 'IntlTimeZone' class method has an entry in this table - */ -static const zend_function_entry TimeZone_class_functions[] = { - PHP_ME(IntlTimeZone, __construct, arginfo_class_IntlTimeZone___construct, ZEND_ACC_PRIVATE) - PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, arginfo_class_IntlTimeZone_createTimeZone, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, arginfo_class_IntlTimeZone_fromDateTimeZone, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(createDefault, intltz_create_default, arginfo_class_IntlTimeZone_createDefault, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getGMT, intltz_get_gmt, arginfo_class_IntlTimeZone_getGMT, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getUnknown, intltz_get_unknown, arginfo_class_IntlTimeZone_getUnknown, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, arginfo_class_IntlTimeZone_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, arginfo_class_IntlTimeZone_countEquivalentIDs, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, arginfo_class_IntlTimeZone_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, arginfo_class_IntlTimeZone_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getRegion, intltz_get_region, arginfo_class_IntlTimeZone_getRegion, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, arginfo_class_IntlTimeZone_getTZDataVersion, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, arginfo_class_IntlTimeZone_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - - PHP_ME_MAPPING(getID, intltz_get_id, arginfo_class_IntlTimeZone_getID, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, arginfo_class_IntlTimeZone_useDaylightTime, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getOffset, intltz_get_offset, arginfo_class_IntlTimeZone_getOffset, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getRawOffset, intltz_get_raw_offset, arginfo_class_IntlTimeZone_getRawOffset, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(hasSameRules, intltz_has_same_rules, arginfo_class_IntlTimeZone_hasSameRules, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getDisplayName, intltz_get_display_name, arginfo_class_IntlTimeZone_getDisplayName, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, arginfo_class_IntlTimeZone_getDSTSavings, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, arginfo_class_IntlTimeZone_toDateTimeZone, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getErrorCode, intltz_get_error_code, arginfo_class_IntlTimeZone_getErrorCode, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(getErrorMessage, intltz_get_error_message, arginfo_class_IntlTimeZone_getErrorMessage, ZEND_ACC_PUBLIC) -#if U_ICU_VERSION_MAJOR_NUM >= 52 - PHP_ME_MAPPING(getWindowsID, intltz_get_windows_id, arginfo_class_IntlTimeZone_getWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME_MAPPING(getIDForWindowsID, intltz_get_id_for_windows_id, arginfo_class_IntlTimeZone_getIDForWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) -#endif - PHP_FE_END -}; -/* }}} */ - /* {{{ timezone_register_IntlTimeZone_class * Initialize 'IntlTimeZone' class */ @@ -435,7 +398,7 @@ U_CFUNC void timezone_register_IntlTimeZone_class(void) zend_class_entry ce; /* Create and register 'IntlTimeZone' class. */ - INIT_CLASS_ENTRY(ce, "IntlTimeZone", TimeZone_class_functions); + INIT_CLASS_ENTRY(ce, "IntlTimeZone", class_IntlTimeZone_methods); ce.create_object = TimeZone_object_create; TimeZone_ce_ptr = zend_register_internal_class(&ce); if (!TimeZone_ce_ptr) { diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h deleted file mode 100644 index 2f9ec349a1..0000000000 --- a/ext/intl/timezone/timezone_methods.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Gustavo Lopes <cataphract@netcabo.pt> | - +----------------------------------------------------------------------+ - */ - -#ifndef TIMEZONE_METHODS_H -#define TIMEZONE_METHODS_H - -#include <php.h> - -PHP_METHOD(IntlTimeZone, __construct); - -PHP_FUNCTION(intltz_create_time_zone); - -PHP_FUNCTION(intltz_from_date_time_zone); - -PHP_FUNCTION(intltz_create_default); - -PHP_FUNCTION(intltz_get_id); - -PHP_FUNCTION(intltz_get_gmt); - -PHP_FUNCTION(intltz_get_unknown); - -PHP_FUNCTION(intltz_create_enumeration); - -PHP_FUNCTION(intltz_count_equivalent_ids); - -PHP_FUNCTION(intltz_create_time_zone_id_enumeration); - -PHP_FUNCTION(intltz_get_canonical_id); - -PHP_FUNCTION(intltz_get_region); - -PHP_FUNCTION(intltz_get_tz_data_version); - -PHP_FUNCTION(intltz_get_equivalent_id); - -PHP_FUNCTION(intltz_use_daylight_time); - -PHP_FUNCTION(intltz_get_offset); - -PHP_FUNCTION(intltz_get_raw_offset); - -PHP_FUNCTION(intltz_has_same_rules); - -PHP_FUNCTION(intltz_get_display_name); - -PHP_FUNCTION(intltz_get_dst_savings); - -PHP_FUNCTION(intltz_to_date_time_zone); - -PHP_FUNCTION(intltz_get_error_code); - -PHP_FUNCTION(intltz_get_error_message); - -#if U_ICU_VERSION_MAJOR_NUM >= 52 -PHP_FUNCTION(intltz_get_windows_id); -PHP_FUNCTION(intltz_get_id_for_windows_id); -#endif - -#endif /* #ifndef TIMEZONE_METHODS_H */ |
