Skip to content

Commit b5d14fc

Browse files
committed
Add support for union return types
1 parent 9884d9f commit b5d14fc

File tree

8 files changed

+28
-37
lines changed

8 files changed

+28
-37
lines changed

ext/intl/grapheme/grapheme.stub.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
<?php
22

3-
/** @return int|false|null */
4-
function grapheme_strlen(string $input) {}
3+
function grapheme_strlen(string $input): int|false|null {}
54

6-
/** @return int|false */
7-
function grapheme_strpos(string $haystack, string $needle, int $offset = 0) {}
5+
function grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false {}
86

9-
/** @return int|false */
10-
function grapheme_stripos(string $haystack, string $needle, int $offset = 0) {}
7+
function grapheme_stripos(string $haystack, string $needle, int $offset = 0): int|false {}
118

12-
/** @return int|false */
13-
function grapheme_strrpos(string $haystack, string $needle, int $offset = 0) {}
9+
function grapheme_strrpos(string $haystack, string $needle, int $offset = 0): int|false {}
1410

15-
/** @return int|false */
16-
function grapheme_strripos(string $haystack, string $needle, int $offset = 0) {}
11+
function grapheme_strripos(string $haystack, string $needle, int $offset = 0): int|false {}
1712

18-
/** @return string|false */
19-
function grapheme_substr(string $string, int $start, ?int $length = 0) {}
13+
function grapheme_substr(string $string, int $start, ?int $length = 0): string|false {}
2014

21-
/** @return string|false */
22-
function grapheme_strstr(string $haystack, string $needle, bool $before_needle = false) {}
15+
function grapheme_strstr(string $haystack, string $needle, bool $before_needle = false): string|false {}
2316

24-
/** @return string|false */
25-
function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false) {}
17+
function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}
2618

27-
/** @return string|false */
28-
function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null) {}
19+
function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null): string|false {}

ext/intl/grapheme/grapheme_arginfo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* This is a generated file, edit the .stub.php file instead. */
22

3-
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strlen, 0, 0, 1)
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
44
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
55
ZEND_END_ARG_INFO()
66

7-
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strpos, 0, 0, 2)
7+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
88
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
99
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
1010
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
@@ -16,21 +16,21 @@ ZEND_END_ARG_INFO()
1616

1717
#define arginfo_grapheme_strripos arginfo_grapheme_strpos
1818

19-
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_substr, 0, 0, 2)
19+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
2020
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
2121
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
2222
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
2323
ZEND_END_ARG_INFO()
2424

25-
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_strstr, 0, 0, 2)
25+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strstr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
2626
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
2727
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
2828
ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0)
2929
ZEND_END_ARG_INFO()
3030

3131
#define arginfo_grapheme_stristr arginfo_grapheme_strstr
3232

33-
ZEND_BEGIN_ARG_INFO_EX(arginfo_grapheme_extract, 0, 0, 2)
33+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_extract, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
3434
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
3535
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
3636
ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0)

ext/intl/idn/idn.stub.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
/** @return string|false */
4-
function idn_to_ascii(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null) {}
3+
function idn_to_ascii(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}
54

6-
/** @return string|false */
7-
function idn_to_utf8(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null) {}
5+
function idn_to_utf8(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}

ext/intl/idn/idn_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* This is a generated file, edit the .stub.php file instead. */
22

3-
ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
3+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idn_to_ascii, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
44
ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
55
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
66
ZEND_ARG_TYPE_INFO(0, variant, IS_LONG, 0)

ext/intl/normalizer/normalizer.stub.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public static function getRawDecomposition(string $input, int $form = Normalizer
1414
#endif
1515
}
1616

17-
/** @return string|false */
18-
function normalizer_normalize(string $input, int $form = Normalizer::FORM_C) {}
17+
function normalizer_normalize(string $input, int $form = Normalizer::FORM_C): string|false {}
1918

2019
function normalizer_is_normalized(string $input, int $form = Normalizer::FORM_C): bool {}
2120

ext/intl/normalizer/normalizer_arginfo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_getRawDecomposition, 0, 0, 1)
1414
ZEND_END_ARG_INFO()
1515
#endif
1616

17-
#define arginfo_normalizer_normalize arginfo_class_Normalizer_normalize
17+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_normalizer_normalize, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
18+
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
19+
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
20+
ZEND_END_ARG_INFO()
1821

1922
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_normalizer_is_normalized, 0, 1, _IS_BOOL, 0)
2023
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)

ext/intl/resourcebundle/resourcebundle.stub.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ function resourcebundle_create(?string $locale, ?string $bundlename, bool $fallb
3535
*/
3636
function resourcebundle_get(ResourceBundle $bundle, $index) {}
3737

38-
/** @return int|false */
39-
function resourcebundle_count(ResourceBundle $bundle) {}
38+
function resourcebundle_count(ResourceBundle $bundle): int|false {}
4039

41-
/** @return array|false */
42-
function resourcebundle_locales(string $bundlename) {}
40+
function resourcebundle_locales(string $bundlename): array|false {}
4341

4442
function resourcebundle_get_error_code(ResourceBundle $bundle): int {}
4543

ext/intl/resourcebundle/resourcebundle_arginfo.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_get, 0, 0, 2)
3131
ZEND_ARG_INFO(0, index)
3232
ZEND_END_ARG_INFO()
3333

34-
ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_count, 0, 0, 1)
34+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_resourcebundle_count, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
3535
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
3636
ZEND_END_ARG_INFO()
3737

38-
#define arginfo_resourcebundle_locales arginfo_class_ResourceBundle_getLocales
38+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_resourcebundle_locales, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
39+
ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 0)
40+
ZEND_END_ARG_INFO()
3941

4042
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_get_error_code, 0, 1, IS_LONG, 0)
4143
ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)

0 commit comments

Comments
 (0)