Skip to content

Commit 6d0366a

Browse files
kocsismatecmb69
authored andcommitted
Add stubs for IntlTimeZone
1 parent 42692d4 commit 6d0366a

File tree

4 files changed

+364
-170
lines changed

4 files changed

+364
-170
lines changed

ext/intl/php_intl.c

Lines changed: 23 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474

7575
#include "timezone/timezone_class.h"
7676
#include "timezone/timezone_methods.h"
77+
#include "timezone/timezone_arginfo.h"
7778

7879
#include "calendar/calendar_class.h"
7980
#include "calendar/calendar_methods.h"
@@ -435,61 +436,6 @@ ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_error, 0, 0, 1 )
435436
ZEND_ARG_OBJ_INFO( 0, trans, Transliterator, 0 )
436437
ZEND_END_ARG_INFO()
437438

438-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 )
439-
ZEND_ARG_INFO( 0, zoneId )
440-
ZEND_END_ARG_INFO()
441-
442-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 )
443-
ZEND_ARG_OBJ_INFO( 0, dateTimeZone, DateTimeZone, 0 )
444-
ZEND_END_ARG_INFO()
445-
446-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 )
447-
ZEND_ARG_INFO( 0, countryOrRawOffset )
448-
ZEND_END_ARG_INFO()
449-
450-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_time_zone_id_enumeration, 0, 0, 1 )
451-
ZEND_ARG_INFO( 0, zoneType )
452-
ZEND_ARG_INFO( 0, region )
453-
ZEND_ARG_INFO( 0, rawOffset )
454-
ZEND_END_ARG_INFO()
455-
456-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_canonical_id, 0, 0, 1 )
457-
ZEND_ARG_INFO( 0, zoneId )
458-
ZEND_ARG_INFO( 1, isSystemID )
459-
ZEND_END_ARG_INFO()
460-
461-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_equivalent_id, 0, 0, 2 )
462-
ZEND_ARG_INFO( 0, zoneId )
463-
ZEND_ARG_INFO( 0, index )
464-
ZEND_END_ARG_INFO()
465-
466-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_offset, 0, 0, 5 )
467-
ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
468-
ZEND_ARG_INFO( 0, date )
469-
ZEND_ARG_INFO( 0, local )
470-
ZEND_ARG_INFO( 1, rawOffset )
471-
ZEND_ARG_INFO( 1, dstOffset )
472-
ZEND_END_ARG_INFO()
473-
474-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_has_same_rules, 0, 0, 1 )
475-
ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
476-
ZEND_ARG_OBJ_INFO( 0, otherTimeZone, IntlTimeZone, 0 )
477-
ZEND_END_ARG_INFO()
478-
479-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_display_name, 0, 0, 1 )
480-
ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
481-
ZEND_ARG_INFO( 0, isDaylight )
482-
ZEND_ARG_INFO( 0, style )
483-
ZEND_ARG_INFO( 0, locale )
484-
ZEND_END_ARG_INFO()
485-
486-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_only_tz, 0, 0, 1 )
487-
ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
488-
ZEND_END_ARG_INFO()
489-
490-
ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_void, 0, 0, 0 )
491-
ZEND_END_ARG_INFO()
492-
493439
ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_create_instance, 0, 0, 0 )
494440
ZEND_ARG_INFO( 0, timeZone )
495441
ZEND_ARG_INFO( 0, locale )
@@ -754,28 +700,28 @@ static const zend_function_entry intl_functions[] = {
754700
PHP_FE( transliterator_get_error_message, arginfo_transliterator_error )
755701

756702
/* TimeZone functions */
757-
PHP_FE( intltz_create_time_zone, arginfo_tz_idarg_static )
758-
PHP_FE( intltz_from_date_time_zone, arginfo_tz_from_date_time_zone )
759-
PHP_FE( intltz_create_default, arginfo_tz_void )
760-
PHP_FE( intltz_get_id, arginfo_tz_only_tz )
761-
PHP_FE( intltz_get_gmt, arginfo_tz_void )
762-
PHP_FE( intltz_get_unknown, arginfo_tz_void )
763-
PHP_FE( intltz_create_enumeration, arginfo_tz_create_enumeration )
764-
PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static )
765-
PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration )
766-
PHP_FE( intltz_get_canonical_id, arginfo_tz_get_canonical_id )
767-
PHP_FE( intltz_get_region, arginfo_tz_idarg_static )
768-
PHP_FE( intltz_get_tz_data_version, arginfo_tz_void )
769-
PHP_FE( intltz_get_equivalent_id, arginfo_tz_get_equivalent_id )
770-
PHP_FE( intltz_use_daylight_time, arginfo_tz_only_tz )
771-
PHP_FE( intltz_get_offset, arginfo_tz_get_offset )
772-
PHP_FE( intltz_get_raw_offset, arginfo_tz_only_tz )
773-
PHP_FE( intltz_has_same_rules, arginfo_tz_has_same_rules )
774-
PHP_FE( intltz_get_display_name, arginfo_tz_get_display_name )
775-
PHP_FE( intltz_get_dst_savings, arginfo_tz_only_tz )
776-
PHP_FE( intltz_to_date_time_zone, arginfo_tz_only_tz )
777-
PHP_FE( intltz_get_error_code, arginfo_tz_only_tz )
778-
PHP_FE( intltz_get_error_message, arginfo_tz_only_tz )
703+
PHP_FE( intltz_create_time_zone, arginfo_intltz_create_time_zone )
704+
PHP_FE( intltz_from_date_time_zone, arginfo_intltz_from_date_time_zone )
705+
PHP_FE( intltz_create_default, arginfo_intltz_create_default )
706+
PHP_FE( intltz_get_id, arginfo_intltz_get_id )
707+
PHP_FE( intltz_get_gmt, arginfo_intltz_get_gmt )
708+
PHP_FE( intltz_get_unknown, arginfo_intltz_get_unknown )
709+
PHP_FE( intltz_create_enumeration, arginfo_intltz_create_enumeration )
710+
PHP_FE( intltz_count_equivalent_ids, arginfo_intltz_count_equivalent_ids )
711+
PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_intltz_create_time_zone_id_enumeration )
712+
PHP_FE( intltz_get_canonical_id, arginfo_intltz_get_canonical_id )
713+
PHP_FE( intltz_get_region, arginfo_intltz_get_region )
714+
PHP_FE( intltz_get_tz_data_version, arginfo_intltz_get_tz_data_version )
715+
PHP_FE( intltz_get_equivalent_id, arginfo_intltz_get_equivalent_id )
716+
PHP_FE( intltz_use_daylight_time, arginfo_intltz_use_daylight_time )
717+
PHP_FE( intltz_get_offset, arginfo_intltz_get_offset )
718+
PHP_FE( intltz_get_raw_offset, arginfo_intltz_get_raw_offset )
719+
PHP_FE( intltz_has_same_rules, arginfo_intltz_has_same_rules )
720+
PHP_FE( intltz_get_display_name, arginfo_intltz_get_display_name )
721+
PHP_FE( intltz_get_dst_savings, arginfo_intltz_get_dst_savings )
722+
PHP_FE( intltz_to_date_time_zone, arginfo_intltz_to_date_time_zone )
723+
PHP_FE( intltz_get_error_code, arginfo_intltz_get_error_code )
724+
PHP_FE( intltz_get_error_message, arginfo_intltz_get_error_message )
779725

780726
PHP_FE( intlcal_create_instance, ainfo_cal_create_instance )
781727
PHP_FE( intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale )

ext/intl/timezone/timezone.stub.php

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?php
2+
3+
class IntlTimeZone
4+
{
5+
private function __construct() {}
6+
7+
/** @return int|false */
8+
public static function countEquivalentIDs(string $zoneId) {}
9+
10+
/** @return IntlTimeZone */
11+
public static function createDefault() {}
12+
13+
/**
14+
* @param IntlTimeZone|string|int|double|null $countryOrRawOffset
15+
* @return IntlIterator|false
16+
*/
17+
public static function createEnumeration($countryOrRawOffset = null) {}
18+
19+
/** @return ?IntlTimeZone */
20+
public static function createTimeZone(string $zoneId) {}
21+
22+
/** @return IntlIterator|false */
23+
public static function createTimeZoneIDEnumeration(int $zoneType, ?string $region = null, ?int $rawOffset = null) {}
24+
25+
/** @return ?IntlTimeZone */
26+
public static function fromDateTimeZone(DateTimeZone $zone) {}
27+
28+
/** @return string|false */
29+
public static function getCanonicalID(string $zoneId, &$isSystemID = null) {}
30+
31+
/** @return string|false */
32+
public function getDisplayName(bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null) {}
33+
34+
/** @return int|false */
35+
public function getDSTSavings() {}
36+
37+
/** @return string|false */
38+
public static function getEquivalentID(string $zoneId, int $index) {}
39+
40+
/** @return int|false */
41+
public function getErrorCode() {}
42+
43+
/** @return string|false */
44+
public function getErrorMessage() {}
45+
46+
/** @return IntlTimeZone */
47+
public static function getGMT() {}
48+
49+
/** @return string|false */
50+
public function getID() {}
51+
52+
/** @return bool */
53+
public function getOffset(float $date, bool $local, &$rawOffset, &$dstOffset) {}
54+
55+
/** @return int|false */
56+
public function getRawOffset() {}
57+
58+
/** @return string|false */
59+
public static function getRegion(string $zoneId) {}
60+
61+
/** @return string|false */
62+
public static function getTZDataVersion() {}
63+
64+
/** @return IntlTimeZone */
65+
public static function getUnknown() {}
66+
67+
#if U_ICU_VERSION_MAJOR_NUM >= 52
68+
/** @return string|false */
69+
public static function getWindowsID(string $timezone) {}
70+
71+
/** @return string|false */
72+
public static function getIDForWindowsID(string $timezone, string $region = UNKNOWN) {}
73+
#endif
74+
/** @return bool */
75+
public function hasSameRules(IntlTimeZone $otherTimeZone) {}
76+
77+
/** @return DateTimeZone|false */
78+
public function toDateTimeZone() {}
79+
80+
/** @return bool */
81+
public function useDaylightTime() {}
82+
}
83+
84+
/** @return int|false */
85+
function intltz_count_equivalent_ids(string $zoneId) {}
86+
87+
function intltz_create_default(): IntlTimeZone {}
88+
89+
/**
90+
* @param IntlTimeZone|string|int|double|null $countryOrRawOffset
91+
* @return IntlIterator|false
92+
*/
93+
function intltz_create_enumeration($countryOrRawOffset = null) {}
94+
95+
function intltz_create_time_zone(string $zoneId): ?IntlTimeZone {}
96+
97+
/** @return IntlIterator|false */
98+
function intltz_create_time_zone_id_enumeration(int $zoneType, ?string $region = null, ?int $rawOffset = null) {}
99+
100+
function intltz_from_date_time_zone(DateTimeZone $zone): ?IntlTimeZone {}
101+
102+
/** @return string|false */
103+
function intltz_get_canonical_id(string $zoneId, &$isSystemID = null) {}
104+
105+
/** @return string|false */
106+
function intltz_get_display_name(IntlTimeZone $tz, bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null) {}
107+
108+
/** @return int|false */
109+
function intltz_get_dst_savings(IntlTimeZone $tz) {}
110+
111+
/** @return string|false */
112+
function intltz_get_equivalent_id(string $zoneId, int $index) {}
113+
114+
/** @return int|false */
115+
function intltz_get_error_code(IntlTimeZone $tz) {}
116+
117+
/** @return string|false */
118+
function intltz_get_error_message(IntlTimeZone $tz) {}
119+
120+
function intltz_get_gmt(): IntlTimeZone {}
121+
122+
/** @return string|false */
123+
function intltz_get_id(IntlTimeZone $tz) {}
124+
125+
function intltz_get_offset(IntlTimeZone $tz, float $date, bool $local, &$rawOffset, &$dstOffset): bool {}
126+
127+
/** @return int|false */
128+
function intltz_get_raw_offset(IntlTimeZone $tz) {}
129+
130+
/** @return string|false */
131+
function intltz_get_region(string $zoneId) {}
132+
133+
/** @return string|false */
134+
function intltz_get_tz_data_version() {}
135+
136+
function intltz_get_unknown(): IntlTimeZone {}
137+
138+
#if U_ICU_VERSION_MAJOR_NUM >= 52
139+
/** @return string|false */
140+
function intltz_get_windows_id(string $timezone) {}
141+
142+
/** @return string|false */
143+
function intltz_get_id_for_windows_id(string $timezone, string $region = UNKNOWN) {}
144+
#endif
145+
146+
function intltz_has_same_rules(IntlTimeZone $tz, IntlTimeZone $otherTimeZone): bool {}
147+
148+
/** @return DateTimeZone|false */
149+
function intltz_to_date_time_zone(IntlTimeZone $tz) {}
150+
151+
function intltz_use_daylight_time(IntlTimeZone $tz): bool {}

0 commit comments

Comments
 (0)