Skip to content

Commit 08092a8

Browse files
committed
Add stubs for IntlDateFormatter
1 parent f226089 commit 08092a8

File tree

5 files changed

+337
-125
lines changed

5 files changed

+337
-125
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<?php
2+
3+
class IntlDateFormatter
4+
{
5+
/**
6+
* @param IntlTimeZone|DateTimeZone|string|null $timezone
7+
* @param IntlCalendar|int|null $calendar
8+
*/
9+
public function __construct(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = "") {}
10+
11+
/**
12+
* @param IntlTimeZone|DateTimeZone|string|null $timezone
13+
* @param IntlCalendar|int|null $calendar
14+
* @return IntlDateFormatter|null
15+
*/
16+
public static function create(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = "") {}
17+
18+
/** @return int */
19+
public function getDateType() {}
20+
21+
/** @return int */
22+
public function getTimeType() {}
23+
24+
/** @return int|false */
25+
public function getCalendar() {}
26+
27+
/**
28+
* @param IntlCalendar|int|null $which
29+
* @return bool
30+
*/
31+
public function setCalendar($which) {}
32+
33+
/** @return string */
34+
public function getTimeZoneId() {}
35+
36+
/** @return IntlCalendar|null|false */
37+
public function getCalendarObject() {}
38+
39+
/** @return IntlTimeZone|false */
40+
public function getTimeZone() {}
41+
42+
/**
43+
* @param IntlTimeZone|DateTimeZone|string|null $zone
44+
* @return bool
45+
*/
46+
public function setTimeZone($zone) {}
47+
48+
/** @return bool */
49+
public function setPattern(string $pattern) {}
50+
51+
/** @return string */
52+
public function getPattern() {}
53+
54+
/** @return string */
55+
public function getLocale(int $which = UNKNOWN) {}
56+
57+
/** @return void */
58+
public function setLenient(bool $lenient) {}
59+
60+
/** @return bool */
61+
public function isLenient() {}
62+
63+
/**
64+
* @param array|int $value
65+
* @return string|false
66+
*/
67+
public function format($value) {}
68+
69+
/**
70+
* @param IntlCalendar|DateTime $object
71+
* @param array|int|string|null $format
72+
* @return string|false
73+
*/
74+
public static function formatObject($object, $format = null, ?string $locale = null) {}
75+
76+
/** @return int|false */
77+
public function parse(string $value, ?int &$position = null) {}
78+
79+
/** @return array|false */
80+
public function localtime(string $value, ?int &$position = null) {}
81+
82+
/** @return int */
83+
public function getErrorCode() {}
84+
85+
/** @return string */
86+
public function getErrorMessage() {}
87+
}
88+
89+
/**
90+
* @param IntlTimeZone|DateTimeZone|string|null $timezone
91+
* @param IntlCalendar|int|null $calendar
92+
* @return IntlDateFormatter|null
93+
*/
94+
function datefmt_create(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = "") {}
95+
96+
/** @return int */
97+
function datefmt_get_datetype(IntlDateFormatter $df) {}
98+
99+
/** @return int */
100+
function datefmt_get_timetype(IntlDateFormatter $df) {}
101+
102+
/** @return int|false */
103+
function datefmt_get_calendar(IntlDateFormatter $df) {}
104+
105+
/**
106+
* @param IntlCalendar|int|null $which
107+
* @return bool
108+
*/
109+
function datefmt_set_calendar(IntlDateFormatter $df, $which) {}
110+
111+
/** @return string */
112+
function datefmt_get_timezone_id(IntlDateFormatter $df) {}
113+
114+
/** @return IntlCalendar|null|false */
115+
function datefmt_get_calendar_object(IntlDateFormatter $df) {}
116+
117+
/** @return IntlTimeZone|false */
118+
function datefmt_get_timezone(IntlDateFormatter $df) {}
119+
120+
/**
121+
* @param IntlTimeZone|DateTimeZone|string|null $zone
122+
* @return bool
123+
*/
124+
function datefmt_set_timezone(IntlDateFormatter $df, $zone) {}
125+
126+
/** @return bool */
127+
function datefmt_set_pattern(IntlDateFormatter $df, string $pattern) {}
128+
129+
/** @return string */
130+
function datefmt_get_pattern(IntlDateFormatter $df) {}
131+
132+
/** @return string */
133+
function datefmt_get_locale(IntlDateFormatter $df, int $which = UNKNOWN) {}
134+
135+
/** @return void */
136+
function datefmt_set_lenient(IntlDateFormatter $df, bool $lenient) {}
137+
138+
/** @return bool */
139+
function datefmt_is_lenient(IntlDateFormatter $df) {}
140+
141+
/**
142+
* @param mixed $value
143+
* @return string|false
144+
*/
145+
function datefmt_format(IntlDateFormatter $df, $value) {}
146+
147+
/**
148+
* @param IntlCalendar|DateTimeInterface $object
149+
* @param array|int|string|null $format
150+
* @return string|false
151+
*/
152+
function datefmt_format_object($object, $format = null, ?string $locale = null) {}
153+
154+
/** @return int|false */
155+
function datefmt_parse(IntlDateFormatter $df, string $value, ?int &$position = null) {}
156+
157+
/** @return array|false */
158+
function datefmt_localtime(IntlDateFormatter $df, string $value, ?int &$position = null) {}
159+
160+
/** @return int */
161+
function datefmt_get_error_code(IntlDateFormatter $df) {}
162+
163+
/** @return string */
164+
function datefmt_get_error_message(IntlDateFormatter $df) {}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/* This is a generated file, edit the .stub.php file instead. */
2+
3+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3)
4+
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
5+
ZEND_ARG_TYPE_INFO(0, datetype, IS_LONG, 0)
6+
ZEND_ARG_TYPE_INFO(0, timetype, IS_LONG, 0)
7+
ZEND_ARG_INFO(0, timezone)
8+
ZEND_ARG_INFO(0, calendar)
9+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
10+
ZEND_END_ARG_INFO()
11+
12+
#define arginfo_class_IntlDateFormatter_create arginfo_class_IntlDateFormatter___construct
13+
14+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getDateType, 0, 0, 0)
15+
ZEND_END_ARG_INFO()
16+
17+
#define arginfo_class_IntlDateFormatter_getTimeType arginfo_class_IntlDateFormatter_getDateType
18+
19+
#define arginfo_class_IntlDateFormatter_getCalendar arginfo_class_IntlDateFormatter_getDateType
20+
21+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setCalendar, 0, 0, 1)
22+
ZEND_ARG_INFO(0, which)
23+
ZEND_END_ARG_INFO()
24+
25+
#define arginfo_class_IntlDateFormatter_getTimeZoneId arginfo_class_IntlDateFormatter_getDateType
26+
27+
#define arginfo_class_IntlDateFormatter_getCalendarObject arginfo_class_IntlDateFormatter_getDateType
28+
29+
#define arginfo_class_IntlDateFormatter_getTimeZone arginfo_class_IntlDateFormatter_getDateType
30+
31+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setTimeZone, 0, 0, 1)
32+
ZEND_ARG_INFO(0, zone)
33+
ZEND_END_ARG_INFO()
34+
35+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setPattern, 0, 0, 1)
36+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
37+
ZEND_END_ARG_INFO()
38+
39+
#define arginfo_class_IntlDateFormatter_getPattern arginfo_class_IntlDateFormatter_getDateType
40+
41+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getLocale, 0, 0, 0)
42+
ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
43+
ZEND_END_ARG_INFO()
44+
45+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setLenient, 0, 0, 1)
46+
ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
47+
ZEND_END_ARG_INFO()
48+
49+
#define arginfo_class_IntlDateFormatter_isLenient arginfo_class_IntlDateFormatter_getDateType
50+
51+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_format, 0, 0, 1)
52+
ZEND_ARG_INFO(0, value)
53+
ZEND_END_ARG_INFO()
54+
55+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_formatObject, 0, 0, 1)
56+
ZEND_ARG_INFO(0, object)
57+
ZEND_ARG_INFO(0, format)
58+
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
59+
ZEND_END_ARG_INFO()
60+
61+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_parse, 0, 0, 1)
62+
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
63+
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
64+
ZEND_END_ARG_INFO()
65+
66+
#define arginfo_class_IntlDateFormatter_localtime arginfo_class_IntlDateFormatter_parse
67+
68+
#define arginfo_class_IntlDateFormatter_getErrorCode arginfo_class_IntlDateFormatter_getDateType
69+
70+
#define arginfo_class_IntlDateFormatter_getErrorMessage arginfo_class_IntlDateFormatter_getDateType
71+
72+
#define arginfo_datefmt_create arginfo_class_IntlDateFormatter___construct
73+
74+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_get_datetype, 0, 0, 1)
75+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
76+
ZEND_END_ARG_INFO()
77+
78+
#define arginfo_datefmt_get_timetype arginfo_datefmt_get_datetype
79+
80+
#define arginfo_datefmt_get_calendar arginfo_datefmt_get_datetype
81+
82+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
83+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
84+
ZEND_ARG_INFO(0, which)
85+
ZEND_END_ARG_INFO()
86+
87+
#define arginfo_datefmt_get_timezone_id arginfo_datefmt_get_datetype
88+
89+
#define arginfo_datefmt_get_calendar_object arginfo_datefmt_get_datetype
90+
91+
#define arginfo_datefmt_get_timezone arginfo_datefmt_get_datetype
92+
93+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_timezone, 0, 0, 2)
94+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
95+
ZEND_ARG_INFO(0, zone)
96+
ZEND_END_ARG_INFO()
97+
98+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
99+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
100+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
101+
ZEND_END_ARG_INFO()
102+
103+
#define arginfo_datefmt_get_pattern arginfo_datefmt_get_datetype
104+
105+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_get_locale, 0, 0, 1)
106+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
107+
ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
108+
ZEND_END_ARG_INFO()
109+
110+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_lenient, 0, 0, 2)
111+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
112+
ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
113+
ZEND_END_ARG_INFO()
114+
115+
#define arginfo_datefmt_is_lenient arginfo_datefmt_get_datetype
116+
117+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 2)
118+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
119+
ZEND_ARG_INFO(0, value)
120+
ZEND_END_ARG_INFO()
121+
122+
#define arginfo_datefmt_format_object arginfo_class_IntlDateFormatter_formatObject
123+
124+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_parse, 0, 0, 2)
125+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
126+
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
127+
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
128+
ZEND_END_ARG_INFO()
129+
130+
#define arginfo_datefmt_localtime arginfo_datefmt_parse
131+
132+
#define arginfo_datefmt_get_error_code arginfo_datefmt_get_datetype
133+
134+
#define arginfo_datefmt_get_error_message arginfo_datefmt_get_datetype

ext/intl/dateformat/dateformat_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ PHP_FUNCTION( datefmt_is_lenient )
206206
}
207207
/* }}} */
208208

209-
/* {{{ proto string IntlDateFormatter::setLenient()
209+
/* {{{ proto void IntlDateFormatter::setLenient()
210210
* Set formatter lenient. }}} */
211-
/* {{{ proto string datefmt_setLenient(IntlDateFormatter $mf)
211+
/* {{{ proto void datefmt_setLenient(IntlDateFormatter $mf)
212212
* Set formatter lenient.
213213
*/
214214
PHP_FUNCTION( datefmt_set_lenient )

0 commit comments

Comments
 (0)