Skip to content

Commit 1cfe1b1

Browse files
committed
Add stubs for IntlDateFormatter
1 parent f226089 commit 1cfe1b1

File tree

6 files changed

+339
-126
lines changed

6 files changed

+339
-126
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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|false */
19+
public function getDateType() {}
20+
21+
/** @return int|false */
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|false */
52+
public function getPattern() {}
53+
54+
/** @return string|false */
55+
public function getLocale(int $which = UNKNOWN) {}
56+
57+
/** @return null|bool */
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+
*/
93+
function datefmt_create(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = ""): ?IntlDateFormatter {}
94+
95+
/** @return int|false */
96+
function datefmt_get_datetype(IntlDateFormatter $df) {}
97+
98+
/** @return int|false */
99+
function datefmt_get_timetype(IntlDateFormatter $df) {}
100+
101+
/** @return int|false */
102+
function datefmt_get_calendar(IntlDateFormatter $df) {}
103+
104+
/** @param IntlCalendar|int|null $which */
105+
function datefmt_set_calendar(IntlDateFormatter $df, $which): bool {}
106+
107+
function datefmt_get_timezone_id(IntlDateFormatter $df): string {}
108+
109+
/** @return IntlCalendar|null|false */
110+
function datefmt_get_calendar_object(IntlDateFormatter $df) {}
111+
112+
/** @return IntlTimeZone|false */
113+
function datefmt_get_timezone(IntlDateFormatter $df) {}
114+
115+
/** @param IntlTimeZone|DateTimeZone|string|null $zone */
116+
function datefmt_set_timezone(IntlDateFormatter $df, $zone): ?bool {}
117+
118+
function datefmt_set_pattern(IntlDateFormatter $df, string $pattern): bool {}
119+
120+
/** @return string|false */
121+
function datefmt_get_pattern(IntlDateFormatter $df) {}
122+
123+
/** @return string|false */
124+
function datefmt_get_locale(IntlDateFormatter $df, int $which = UNKNOWN) {}
125+
126+
/** @return null|bool */
127+
function datefmt_set_lenient(IntlDateFormatter $df, bool $lenient) {}
128+
129+
function datefmt_is_lenient(IntlDateFormatter $df): bool {}
130+
131+
/**
132+
* @param mixed $value
133+
* @return string|false
134+
*/
135+
function datefmt_format(IntlDateFormatter $df, $value) {}
136+
137+
/**
138+
* @param IntlCalendar|DateTimeInterface $object
139+
* @param array|int|string|null $format
140+
* @return string|false
141+
*/
142+
function datefmt_format_object($object, $format = null, ?string $locale = null) {}
143+
144+
/** @return int|false */
145+
function datefmt_parse(IntlDateFormatter $df, string $value, ?int &$position = null) {}
146+
147+
/** @return array|false */
148+
function datefmt_localtime(IntlDateFormatter $df, string $value, ?int &$position = null) {}
149+
150+
function datefmt_get_error_code(IntlDateFormatter $df): int {}
151+
152+
function datefmt_get_error_message(IntlDateFormatter $df): string {}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
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+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_datefmt_create, 0, 3, IntlDateFormatter, 1)
73+
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
74+
ZEND_ARG_TYPE_INFO(0, datetype, IS_LONG, 0)
75+
ZEND_ARG_TYPE_INFO(0, timetype, IS_LONG, 0)
76+
ZEND_ARG_INFO(0, timezone)
77+
ZEND_ARG_INFO(0, calendar)
78+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
79+
ZEND_END_ARG_INFO()
80+
81+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_get_datetype, 0, 0, 1)
82+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
83+
ZEND_END_ARG_INFO()
84+
85+
#define arginfo_datefmt_get_timetype arginfo_datefmt_get_datetype
86+
87+
#define arginfo_datefmt_get_calendar arginfo_datefmt_get_datetype
88+
89+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_calendar, 0, 2, _IS_BOOL, 0)
90+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
91+
ZEND_ARG_INFO(0, which)
92+
ZEND_END_ARG_INFO()
93+
94+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_timezone_id, 0, 1, IS_STRING, 0)
95+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
96+
ZEND_END_ARG_INFO()
97+
98+
#define arginfo_datefmt_get_calendar_object arginfo_datefmt_get_datetype
99+
100+
#define arginfo_datefmt_get_timezone arginfo_datefmt_get_datetype
101+
102+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_timezone, 0, 2, _IS_BOOL, 1)
103+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
104+
ZEND_ARG_INFO(0, zone)
105+
ZEND_END_ARG_INFO()
106+
107+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_pattern, 0, 2, _IS_BOOL, 0)
108+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
109+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
110+
ZEND_END_ARG_INFO()
111+
112+
#define arginfo_datefmt_get_pattern arginfo_datefmt_get_datetype
113+
114+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_get_locale, 0, 0, 1)
115+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
116+
ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
117+
ZEND_END_ARG_INFO()
118+
119+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_lenient, 0, 0, 2)
120+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
121+
ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
122+
ZEND_END_ARG_INFO()
123+
124+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_is_lenient, 0, 1, _IS_BOOL, 0)
125+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
126+
ZEND_END_ARG_INFO()
127+
128+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 2)
129+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
130+
ZEND_ARG_INFO(0, value)
131+
ZEND_END_ARG_INFO()
132+
133+
#define arginfo_datefmt_format_object arginfo_class_IntlDateFormatter_formatObject
134+
135+
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_parse, 0, 0, 2)
136+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
137+
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
138+
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
139+
ZEND_END_ARG_INFO()
140+
141+
#define arginfo_datefmt_localtime arginfo_datefmt_parse
142+
143+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_code, 0, 1, IS_LONG, 0)
144+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
145+
ZEND_END_ARG_INFO()
146+
147+
#define arginfo_datefmt_get_error_message arginfo_datefmt_get_timezone_id

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)