Skip to content

Standardize mbstring and string on using 'string' as a parameter name. #6171

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
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions ext/mbstring/mbstring.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand All @@ -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 {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, change these $source_strings as well?


function mb_strtoupper(string $source_string, ?string $encoding = null): string {}

function mb_strtolower(string $source_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 {}

Expand All @@ -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 {}

Expand Down
22 changes: 11 additions & 11 deletions ext/mbstring/mbstring_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: e02a0588d1f46fa96452558e35ea904907b8bdf2 */
* Stub hash: b46e386ae13bb2db6498340c1b28f4e4f6b99b5e */

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")
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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")
Expand All @@ -92,15 +92,15 @@ 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, "\"\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
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()
Expand All @@ -119,7 +119,7 @@ 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()
Expand All @@ -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\"")
Expand All @@ -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()
Expand Down Expand Up @@ -187,12 +187,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_check_encoding, 0, 0, _IS_BOO
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(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()

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()

Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/tests/mb_ord.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down