Skip to content

Commit 52b3638

Browse files
committed
Fix arginfo
1 parent 1f9c10a commit 52b3638

File tree

4 files changed

+47
-44
lines changed

4 files changed

+47
-44
lines changed

ext/intl/dateformat/dateformat.stub.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getCalendar() {}
3030
*/
3131
public function setCalendar($which) {}
3232

33-
/** @return string */
33+
/** @return string|false */
3434
public function getTimeZoneId() {}
3535

3636
/** @return IntlCalendar|null|false */
@@ -54,7 +54,7 @@ public function getPattern() {}
5454
/** @return string|false */
5555
public function getLocale(int $which = UNKNOWN) {}
5656

57-
/** @return null|bool */
57+
/** @return void */
5858
public function setLenient(bool $lenient) {}
5959

6060
/** @return bool */
@@ -73,11 +73,11 @@ public function format($value) {}
7373
*/
7474
public static function formatObject($object, $format = null, ?string $locale = null) {}
7575

76-
/** @return int|false */
77-
public function parse(string $value, ?int &$position = null) {}
76+
/** @return int|float|false */
77+
public function parse(string $value, &$position = null) {}
7878

7979
/** @return array|false */
80-
public function localtime(string $value, ?int &$position = null) {}
80+
public function localtime(string $value, &$position = null) {}
8181

8282
/** @return int */
8383
public function getErrorCode() {}
@@ -101,13 +101,11 @@ function datefmt_get_calendar(IntlDateFormatter $df): int|false {}
101101
/** @param IntlCalendar|int|null $which */
102102
function datefmt_set_calendar(IntlDateFormatter $df, $which): bool {}
103103

104-
function datefmt_get_timezone_id(IntlDateFormatter $df): string {}
104+
function datefmt_get_timezone_id(IntlDateFormatter $df): string|false {}
105105

106-
/** @return IntlCalendar|null|false */
107-
function datefmt_get_calendar_object(IntlDateFormatter $df) {}
106+
function datefmt_get_calendar_object(IntlDateFormatter $df): IntlCalendar|false|null {}
108107

109-
/** @return IntlTimeZone|false */
110-
function datefmt_get_timezone(IntlDateFormatter $df) {}
108+
function datefmt_get_timezone(IntlDateFormatter $df): IntlTimeZone|false {}
111109

112110
/** @param IntlTimeZone|DateTimeZone|string|null $zone */
113111
function datefmt_set_timezone(IntlDateFormatter $df, $zone): ?bool {}
@@ -118,7 +116,7 @@ function datefmt_get_pattern(IntlDateFormatter $df): string|false {}
118116

119117
function datefmt_get_locale(IntlDateFormatter $df, int $which = UNKNOWN): string|false {}
120118

121-
function datefmt_set_lenient(IntlDateFormatter $df, bool $lenient): null|bool {}
119+
function datefmt_set_lenient(IntlDateFormatter $df, bool $lenient): void {}
122120

123121
function datefmt_is_lenient(IntlDateFormatter $df): bool {}
124122

@@ -131,9 +129,9 @@ function datefmt_format(IntlDateFormatter $df, $value): string|false {}
131129
*/
132130
function datefmt_format_object($object, $format = null, ?string $locale = null): string|false {}
133131

134-
function datefmt_parse(IntlDateFormatter $df, string $value, ?int &$position = null): int|false {}
132+
function datefmt_parse(IntlDateFormatter $df, string $value, &$position = null): int|float|false {}
135133

136-
function datefmt_localtime(IntlDateFormatter $df, string $value, ?int &$position = null): array|false {}
134+
function datefmt_localtime(IntlDateFormatter $df, string $value, &$position = null): array|false {}
137135

138136
function datefmt_get_error_code(IntlDateFormatter $df): int {}
139137

ext/intl/dateformat/dateformat_arginfo.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ZEND_END_ARG_INFO()
6060

6161
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_parse, 0, 0, 1)
6262
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
63-
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
63+
ZEND_ARG_INFO(1, position)
6464
ZEND_END_ARG_INFO()
6565

6666
#define arginfo_class_IntlDateFormatter_localtime arginfo_class_IntlDateFormatter_parse
@@ -91,15 +91,17 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_calendar, 0, 2, _IS_
9191
ZEND_ARG_INFO(0, which)
9292
ZEND_END_ARG_INFO()
9393

94-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_timezone_id, 0, 1, IS_STRING, 0)
94+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_timezone_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
9595
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
9696
ZEND_END_ARG_INFO()
9797

98-
ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_get_calendar_object, 0, 0, 1)
98+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_datefmt_get_calendar_object, 0, 1, IntlCalendar, MAY_BE_FALSE|MAY_BE_NULL)
9999
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
100100
ZEND_END_ARG_INFO()
101101

102-
#define arginfo_datefmt_get_timezone arginfo_datefmt_get_calendar_object
102+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_datefmt_get_timezone, 0, 1, IntlTimeZone, MAY_BE_FALSE)
103+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
104+
ZEND_END_ARG_INFO()
103105

104106
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_timezone, 0, 2, _IS_BOOL, 1)
105107
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
@@ -111,16 +113,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_pattern, 0, 2, _IS_B
111113
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
112114
ZEND_END_ARG_INFO()
113115

114-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_pattern, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
115-
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
116-
ZEND_END_ARG_INFO()
116+
#define arginfo_datefmt_get_pattern arginfo_datefmt_get_timezone_id
117117

118118
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_locale, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
119119
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
120120
ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
121121
ZEND_END_ARG_INFO()
122122

123-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_set_lenient, 0, 2, MAY_BE_NULL|MAY_BE_BOOL)
123+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_lenient, 0, 2, IS_VOID, 0)
124124
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
125125
ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
126126
ZEND_END_ARG_INFO()
@@ -140,20 +140,22 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_format_object, 0, 1, MAY
140140
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
141141
ZEND_END_ARG_INFO()
142142

143-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_parse, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
143+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_parse, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE)
144144
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
145145
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
146-
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
146+
ZEND_ARG_INFO(1, position)
147147
ZEND_END_ARG_INFO()
148148

149149
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_localtime, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
150150
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
151151
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
152-
ZEND_ARG_TYPE_INFO(1, position, IS_LONG, 1)
152+
ZEND_ARG_INFO(1, position)
153153
ZEND_END_ARG_INFO()
154154

155155
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_code, 0, 1, IS_LONG, 0)
156156
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
157157
ZEND_END_ARG_INFO()
158158

159-
#define arginfo_datefmt_get_error_message arginfo_datefmt_get_timezone_id
159+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_message, 0, 1, IS_STRING, 0)
160+
ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
161+
ZEND_END_ARG_INFO()

ext/intl/msgformat/msgformat.stub.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function setPattern(string $pattern) {}
2525
/** @return string|false */
2626
public function getPattern() {}
2727

28-
/** @return string|false */
28+
/** @return string */
2929
public function getLocale() {}
3030

3131
/** @return int */
@@ -39,22 +39,17 @@ function msgfmt_create(string $locale, string $pattern): ?MessageFormatter {}
3939

4040
function msgfmt_format(MessageFormatter $fmt, array $args): string|false {}
4141

42-
/** @return string|false */
43-
function msgfmt_format_message(string $locale, string $pattern, array $args) {}
42+
function msgfmt_format_message(string $locale, string $pattern, array $args): string|false {}
4443

45-
/** @return array|false */
46-
function msgfmt_parse(MessageFormatter $fmt, string $value) {}
44+
function msgfmt_parse(MessageFormatter $fmt, string $value): array|false {}
4745

48-
/** @return array|false */
49-
function msgfmt_parse_message(string $locale, string $pattern, string $source) {}
46+
function msgfmt_parse_message(string $locale, string $pattern, string $source): array|false {}
5047

5148
function msgfmt_set_pattern(MessageFormatter $fmt, string $pattern): bool {}
5249

53-
/** @return string|false */
54-
function msgfmt_get_pattern(MessageFormatter $fmt) {}
50+
function msgfmt_get_pattern(MessageFormatter $fmt): string|false {}
5551

56-
/** @return string|false */
57-
function msgfmt_get_locale(MessageFormatter $fmt) {}
52+
function msgfmt_get_locale(MessageFormatter $fmt): string {}
5853

5954
function msgfmt_get_error_code(MessageFormatter $fmt): int {}
6055

ext/intl/msgformat/msgformat_arginfo.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,38 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_format, 0, 2, MAY_BE_STRI
5050
ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
5151
ZEND_END_ARG_INFO()
5252

53-
#define arginfo_msgfmt_format_message arginfo_class_MessageFormatter_formatMessage
53+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_format_message, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
54+
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
55+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
56+
ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
57+
ZEND_END_ARG_INFO()
5458

55-
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
59+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_parse, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
5660
ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
5761
ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
5862
ZEND_END_ARG_INFO()
5963

60-
#define arginfo_msgfmt_parse_message arginfo_class_MessageFormatter_parseMessage
64+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_parse_message, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
65+
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
66+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
67+
ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
68+
ZEND_END_ARG_INFO()
6169

6270
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_set_pattern, 0, 2, _IS_BOOL, 0)
6371
ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
6472
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
6573
ZEND_END_ARG_INFO()
6674

67-
ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_pattern, 0, 0, 1)
75+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_get_pattern, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
6876
ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
6977
ZEND_END_ARG_INFO()
7078

71-
#define arginfo_msgfmt_get_locale arginfo_msgfmt_get_pattern
72-
73-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_error_code, 0, 1, IS_LONG, 0)
79+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_locale, 0, 1, IS_STRING, 0)
7480
ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
7581
ZEND_END_ARG_INFO()
7682

77-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_error_message, 0, 1, IS_STRING, 0)
83+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_error_code, 0, 1, IS_LONG, 0)
7884
ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
7985
ZEND_END_ARG_INFO()
86+
87+
#define arginfo_msgfmt_get_error_message arginfo_msgfmt_get_locale

0 commit comments

Comments
 (0)