From 94854e0dff581e3cdf3ab635e8cdb30f22020c3f Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Sat, 19 Sep 2020 19:04:49 -0500 Subject: [PATCH] Standardize mbstring and string on using 'string' as a parameter name. Closes GH-6171. --- ext/mbstring/mbstring.stub.php | 30 +++++++++++++++--------------- ext/mbstring/mbstring_arginfo.h | 29 +++++++++++++---------------- ext/mbstring/tests/mb_ord.phpt | 2 +- 3 files changed, 29 insertions(+), 32 deletions(-) diff --git a/ext/mbstring/mbstring.stub.php b/ext/mbstring/mbstring.stub.php index 74f86404cf..be54303896 100644 --- a/ext/mbstring/mbstring.stub.php +++ b/ext/mbstring/mbstring.stub.php @@ -21,9 +21,9 @@ function mb_parse_str(string $encoded_string, &$result): bool {} function mb_output_handler(string $contents, int $status): string {} -function mb_str_split(string $str, int $split_length = 1, ?string $encoding = null): array {} +function mb_str_split(string $string, int $split_length = 1, ?string $encoding = null): array {} -function mb_strlen(string $str, ?string $encoding = null): int {} +function mb_strlen(string $string, ?string $encoding = null): int {} function mb_strpos(string $haystack, string $needle, int $offset = 0, ?string $encoding = null): int|false {} @@ -43,33 +43,33 @@ function mb_strrichr(string $haystack, string $needle, bool $part = false, ?stri function mb_substr_count(string $haystack, string $needle, ?string $encoding = null): int {} -function mb_substr(string $str, int $start, ?int $length = null, ?string $encoding = null): string {} +function mb_substr(string $string, int $start, ?int $length = null, ?string $encoding = null): string {} -function mb_strcut(string $str, int $start, ?int $length = null, ?string $encoding = null): string {} +function mb_strcut(string $string, int $start, ?int $length = null, ?string $encoding = null): string {} -function mb_strwidth(string $str, ?string $encoding = null): int {} +function mb_strwidth(string $string, ?string $encoding = null): int {} -function mb_strimwidth(string $str, int $start, int $width, string $trim_marker = "", ?string $encoding = null): string {} +function mb_strimwidth(string $string, int $start, int $width, string $trim_marker = "", ?string $encoding = null): string {} -function mb_convert_encoding(array|string $str, string $to, array|string|null $from = null): array|string|false {} +function mb_convert_encoding(array|string $string, string $to, array|string|null $from = null): array|string|false {} -function mb_convert_case(string $source_string, int $mode, ?string $encoding = null): string {} +function mb_convert_case(string $string, int $mode, ?string $encoding = null): string {} -function mb_strtoupper(string $source_string, ?string $encoding = null): string {} +function mb_strtoupper(string $string, ?string $encoding = null): string {} -function mb_strtolower(string $source_string, ?string $encoding = null): string {} +function mb_strtolower(string $string, ?string $encoding = null): string {} -function mb_detect_encoding(string $str, array|string|null $encoding_list = null, bool $strict = false): string|false {} +function mb_detect_encoding(string $string, array|string|null $encoding_list = null, bool $strict = false): string|false {} function mb_list_encodings(): array {} function mb_encoding_aliases(string $encoding): array {} -function mb_encode_mimeheader(string $str, ?string $charset = null, ?string $transfer = null, string $linefeed = "\r\n", int $indent = 0): string {} +function mb_encode_mimeheader(string $string, ?string $charset = null, ?string $transfer = null, string $linefeed = "\r\n", int $indent = 0): string {} function mb_decode_mimeheader(string $string): string {} -function mb_convert_kana(string $str, string $option = "KV", ?string $encoding = null): string {} +function mb_convert_kana(string $string, string $option = "KV", ?string $encoding = null): string {} function mb_convert_variables(string $to, array|string $from, mixed &$var, mixed &...$vars): string|false {} @@ -83,9 +83,9 @@ function mb_get_info(string $type = "all"): array|string|int|false {} function mb_check_encoding(array|string|null $var = null, ?string $encoding = null): bool {} -function mb_scrub(string $str, ?string $encoding = null): string {} +function mb_scrub(string $string, ?string $encoding = null): string {} -function mb_ord(string $str, ?string $encoding = null): int|false {} +function mb_ord(string $string, ?string $encoding = null): int|false {} function mb_chr(int $cp, ?string $encoding = null): string|false {} diff --git a/ext/mbstring/mbstring_arginfo.h b/ext/mbstring/mbstring_arginfo.h index 27b692c26f..6e71343ce4 100644 --- a/ext/mbstring/mbstring_arginfo.h +++ b/ext/mbstring/mbstring_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e02a0588d1f46fa96452558e35ea904907b8bdf2 */ + * Stub hash: 85cabf678a06175d4da073be79a0951d4f3786ed */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, language, IS_STRING, 1, "null") @@ -38,13 +38,13 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_output_handler, 0, 2, IS_STRI ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_str_split, 0, 1, IS_ARRAY, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, split_length, IS_LONG, 0, "1") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_strlen, 0, 1, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -81,7 +81,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_substr_count, 0, 2, IS_LONG, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_substr, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") @@ -92,7 +92,7 @@ ZEND_END_ARG_INFO() #define arginfo_mb_strwidth arginfo_mb_strlen ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_strimwidth, 0, 3, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, trim_marker, IS_STRING, 0, "\"\"") @@ -100,26 +100,26 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_strimwidth, 0, 3, IS_STRING, ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_convert_encoding, 0, 2, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_MASK(0, str, MAY_BE_ARRAY|MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_MASK(0, string, MAY_BE_ARRAY|MAY_BE_STRING, NULL) ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, from, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_convert_case, 0, 2, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, source_string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_strtoupper, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, source_string, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() #define arginfo_mb_strtolower arginfo_mb_strtoupper ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_detect_encoding, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_MASK(0, encoding_list, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, strict, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -132,7 +132,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_encoding_aliases, 0, 1, IS_AR ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_encode_mimeheader, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charset, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, transfer, IS_STRING, 1, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, linefeed, IS_STRING, 0, "\"\\r\\n\"") @@ -144,7 +144,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_decode_mimeheader, 0, 1, IS_S ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_convert_kana, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, option, IS_STRING, 0, "\"KV\"") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() @@ -186,13 +186,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_check_encoding, 0, 0, _IS_BOO ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_scrub, 0, 1, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") -ZEND_END_ARG_INFO() +#define arginfo_mb_scrub arginfo_mb_strtoupper ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ord, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null") ZEND_END_ARG_INFO() diff --git a/ext/mbstring/tests/mb_ord.phpt b/ext/mbstring/tests/mb_ord.phpt index 8785a29dfc..8336d573be 100644 --- a/ext/mbstring/tests/mb_ord.phpt +++ b/ext/mbstring/tests/mb_ord.phpt @@ -56,7 +56,7 @@ try { bool(true) bool(true) bool(true) -mb_ord(): Argument #1 ($str) must not be empty +mb_ord(): Argument #1 ($string) must not be empty mb_ord(): Argument #2 ($encoding) must be a valid encoding, "typo" given mb_ord(): Argument #2 ($encoding) must be a valid encoding, "pass" given mb_ord() does not support the "JIS" encoding -- 2.40.0