-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add various stubs for Intl #4819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
927dbfe
Add stubs for idn functions
kocsismate 4cf4059
Add stubs for grapheme functions
kocsismate 8ec5e6d
Add stubs for Spoofchecker
kocsismate 1a6ed91
Add stubs for Normalizer
kocsismate 84dee6c
Add stubs for ResourceBundle
kocsismate 80f92fc
Fix arginfos
kocsismate 13cef1a
Add support for union return types
kocsismate 6bb9002
Fix arginfo for resourcebundle_create()
kocsismate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
function grapheme_strlen(string $input): int|false|null {} | ||
|
||
function grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false {} | ||
|
||
function grapheme_stripos(string $haystack, string $needle, int $offset = 0): int|false {} | ||
|
||
function grapheme_strrpos(string $haystack, string $needle, int $offset = 0): int|false {} | ||
|
||
function grapheme_strripos(string $haystack, string $needle, int $offset = 0): int|false {} | ||
|
||
function grapheme_substr(string $string, int $start, ?int $length = 0): string|false {} | ||
|
||
function grapheme_strstr(string $haystack, string $needle, bool $before_needle = false): string|false {} | ||
|
||
function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false): string|false {} | ||
|
||
function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null): string|false {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This is a generated file, edit the .stub.php file instead. */ | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
#define arginfo_grapheme_stripos arginfo_grapheme_strpos | ||
|
||
#define arginfo_grapheme_strrpos arginfo_grapheme_strpos | ||
|
||
#define arginfo_grapheme_strripos arginfo_grapheme_strpos | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) | ||
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1) | ||
ZEND_END_ARG_INFO() | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strstr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
#define arginfo_grapheme_stristr arginfo_grapheme_strstr | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_extract, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0) | ||
ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0) | ||
ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) | ||
ZEND_ARG_INFO(1, next) | ||
ZEND_END_ARG_INFO() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
function idn_to_ascii(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {} | ||
|
||
function idn_to_utf8(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* This is a generated file, edit the .stub.php file instead. */ | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idn_to_ascii, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0) | ||
ZEND_ARG_TYPE_INFO(0, variant, IS_LONG, 0) | ||
ZEND_ARG_INFO(1, idna_info) | ||
ZEND_END_ARG_INFO() | ||
|
||
#define arginfo_idn_to_utf8 arginfo_idn_to_ascii |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Normalizer | ||
{ | ||
/** @return string|false */ | ||
public static function normalize(string $input, int $form = Normalizer::FORM_C) {} | ||
|
||
/** @return bool */ | ||
public static function isNormalized(string $input, int $form = Normalizer::FORM_C) {} | ||
|
||
#if U_ICU_VERSION_MAJOR_NUM >= 56 | ||
/** @return string|null */ | ||
public static function getRawDecomposition(string $input, int $form = Normalizer::FORM_C) {} | ||
#endif | ||
} | ||
|
||
function normalizer_normalize(string $input, int $form = Normalizer::FORM_C): string|false {} | ||
|
||
function normalizer_is_normalized(string $input, int $form = Normalizer::FORM_C): bool {} | ||
|
||
#if U_ICU_VERSION_MAJOR_NUM >= 56 | ||
function normalizer_get_raw_decomposition(string $input, int $form = Normalizer::FORM_C): ?string {} | ||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* This is a generated file, edit the .stub.php file instead. */ | ||
|
||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_normalize, 0, 0, 1) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
#define arginfo_class_Normalizer_isNormalized arginfo_class_Normalizer_normalize | ||
|
||
#if U_ICU_VERSION_MAJOR_NUM >= 56 | ||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_getRawDecomposition, 0, 0, 1) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
#endif | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_normalizer_normalize, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_normalizer_is_normalized, 0, 1, _IS_BOOL, 0) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
|
||
#if U_ICU_VERSION_MAJOR_NUM >= 56 | ||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_normalizer_get_raw_decomposition, 0, 1, IS_STRING, 1) | ||
ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0) | ||
ZEND_END_ARG_INFO() | ||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
class ResourceBundle implements Traversable | ||
{ | ||
public function __construct(?string $locale, ?string $bundlename, bool $fallback = true) {} | ||
|
||
/** @return ResourceBundle|null */ | ||
public static function create(?string $locale, ?string $bundlename, bool $fallback = true) {} | ||
|
||
/** | ||
* @param string|int $index | ||
* @return mixed | ||
*/ | ||
public function get($index, bool $fallback = true) {} | ||
|
||
/** @return int|false */ | ||
public function count() {} | ||
|
||
/** @return array|false */ | ||
public static function getLocales(string $bundlename) {} | ||
|
||
/** @return int */ | ||
public function getErrorCode() {} | ||
|
||
/** @return string */ | ||
public function getErrorMessage() {} | ||
} | ||
|
||
function resourcebundle_create(?string $locale, ?string $bundlename, bool $fallback = true): ?ResourceBundle {} | ||
|
||
/** | ||
* @param string|int $index | ||
* @return mixed | ||
*/ | ||
function resourcebundle_get(ResourceBundle $bundle, $index) {} | ||
|
||
function resourcebundle_count(ResourceBundle $bundle): int|false {} | ||
|
||
function resourcebundle_locales(string $bundlename): array|false {} | ||
|
||
function resourcebundle_get_error_code(ResourceBundle $bundle): int {} | ||
|
||
function resourcebundle_get_error_message(ResourceBundle $bundle): string {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should convert the "unconstructed" case into a hard Error exception in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like this change! Will provide a PR sometime soon.