Skip to content

Commit 65bde6b

Browse files
committed
Review parameter names in ext/pcre
1 parent 4a30c76 commit 65bde6b

10 files changed

+36
-36
lines changed

ext/pcre/php_pcre.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, bool is_filter)
22952295

22962296
/* If replace is an array then the regex argument needs to also be an array */
22972297
if (replace_ht && !regex_ht) {
2298-
zend_argument_type_error(1, "must be of type array when argument #2 ($replace) is an array, string given");
2298+
zend_argument_type_error(1, "must be of type array when argument #2 ($replacement) is an array, string given");
22992299
RETURN_THROWS();
23002300
}
23012301

ext/pcre/php_pcre.stub.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
/** @generate-function-entries */
44

5-
/** @param array $subpatterns */
6-
function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false {}
5+
/** @param array $matches */
6+
function preg_match(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}
77

8-
/** @param array $subpatterns */
9-
function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false|null {}
8+
/** @param array $matches */
9+
function preg_match_all(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false|null {}
1010

1111
/** @param int $count */
12-
function preg_replace(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
12+
function preg_replace(string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
1313

1414
/** @param int $count */
15-
function preg_filter(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
15+
function preg_filter(string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
1616

1717
/** @param int $count */
18-
function preg_replace_callback(string|array $regex, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
18+
function preg_replace_callback(string|array $pattern, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
1919

2020
/** @param int $count */
2121
function preg_replace_callback_array(array $pattern, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
2222

2323
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {}
2424

25-
function preg_quote(string $str, ?string $delim_char = null): string {}
25+
function preg_quote(string $str, ?string $delimiter = null): string {}
2626

27-
function preg_grep(string $regex, array $input, int $flags = 0): array|false {}
27+
function preg_grep(string $pattern, array $array, int $flags = 0): array|false {}
2828

2929
function preg_last_error(): int {}
3030

ext/pcre/php_pcre_arginfo.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 8270971708afa7fa9d82bec0f84c66cc8283f17d */
2+
* Stub hash: 2e5a9edc9635edd4f5a00e9d888fb34c1746a5b8 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
66
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
7-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, subpatterns, "null")
7+
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matches, "null")
88
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
99
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
1010
ZEND_END_ARG_INFO()
1111

1212
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match_all, 0, 2, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
1313
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
1414
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
15-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, subpatterns, "null")
15+
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matches, "null")
1616
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
1717
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
1818
ZEND_END_ARG_INFO()
1919

2020
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
21-
ZEND_ARG_TYPE_MASK(0, regex, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
22-
ZEND_ARG_TYPE_MASK(0, replace, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
21+
ZEND_ARG_TYPE_MASK(0, pattern, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
22+
ZEND_ARG_TYPE_MASK(0, replacement, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
2323
ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
2424
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
2525
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, count, "null")
@@ -28,7 +28,7 @@ ZEND_END_ARG_INFO()
2828
#define arginfo_preg_filter arginfo_preg_replace
2929

3030
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace_callback, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
31-
ZEND_ARG_TYPE_MASK(0, regex, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
31+
ZEND_ARG_TYPE_MASK(0, pattern, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
3232
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
3333
ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
3434
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
@@ -53,12 +53,12 @@ ZEND_END_ARG_INFO()
5353

5454
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_quote, 0, 1, IS_STRING, 0)
5555
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
56-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delim_char, IS_STRING, 1, "null")
56+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 1, "null")
5757
ZEND_END_ARG_INFO()
5858

5959
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_grep, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
60-
ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
61-
ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
60+
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
61+
ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
6262
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
6363
ZEND_END_ARG_INFO()
6464

ext/pcre/tests/bug21732.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ try {
1717
var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
1818
?>
1919
--EXPECT--
20-
preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
20+
preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
2121
array(4) {
2222
[0]=>
2323
string(5) "abcde"

ext/pcre/tests/preg_grep_error1.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
5656
bool(false)
5757

5858
Arg value is Array
59-
preg_grep(): Argument #1 ($regex) must be of type string, array given
59+
preg_grep(): Argument #1 ($pattern) must be of type string, array given
6060

6161
Arg value is /[a-zA-Z]/
6262
array(2) {
@@ -65,5 +65,5 @@ array(2) {
6565
[2]=>
6666
string(4) "test"
6767
}
68-
preg_grep(): Argument #1 ($regex) must be of type string, stdClass given
68+
preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given
6969
Done

ext/pcre/tests/preg_match_all_error3.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "Done";
1717
--EXPECTF--
1818
*** Testing preg_match_all() : error conditions ***
1919

20-
Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($subpatterns) cannot be passed by reference in %s:%d
20+
Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($matches) cannot be passed by reference in %s:%d
2121
Stack trace:
2222
#0 {main}
2323
thrown in %s on line %d

ext/pcre/tests/preg_replace_error1.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ string(1) "a"
5656

5757
Arg value is /[a-zA-Z]/
5858
string(1) "1"
59-
preg_replace(): Argument #1 ($regex) must be of type array|string, stdClass given
59+
preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given

ext/pcre/tests/preg_replace_error2.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ Arg value is: this is a string
3535
string(64) "this is a stringthis is a stringthis is a stringthis is a string"
3636

3737
Arg value is: Array
38-
preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
39-
preg_replace(): Argument #2 ($replace) must be of type array|string, stdClass given
38+
preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
39+
preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given
4040
Done

ext/standard/tests/streams/bug61115.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ try {
1414
}
1515
?>
1616
--EXPECT--
17-
preg_replace(): Argument #2 ($replace) must be of type array|string, Closure given
17+
preg_replace(): Argument #2 ($replacement) must be of type array|string, Closure given

sapi/cli/tests/006.phpt

+9-9
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
7070
- Parameters [5] {
7171
Parameter #0 [ <required> string $pattern ]
7272
Parameter #1 [ <required> string $subject ]
73-
Parameter #2 [ <optional> &$subpatterns = null ]
73+
Parameter #2 [ <optional> &$matches = null ]
7474
Parameter #3 [ <optional> int $flags = 0 ]
7575
Parameter #4 [ <optional> int $offset = 0 ]
7676
}
@@ -81,7 +81,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
8181
- Parameters [5] {
8282
Parameter #0 [ <required> string $pattern ]
8383
Parameter #1 [ <required> string $subject ]
84-
Parameter #2 [ <optional> &$subpatterns = null ]
84+
Parameter #2 [ <optional> &$matches = null ]
8585
Parameter #3 [ <optional> int $flags = 0 ]
8686
Parameter #4 [ <optional> int $offset = 0 ]
8787
}
@@ -90,8 +90,8 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
9090
Function [ <internal:pcre> function preg_replace ] {
9191

9292
- Parameters [5] {
93-
Parameter #0 [ <required> array|string $regex ]
94-
Parameter #1 [ <required> array|string $replace ]
93+
Parameter #1 [ <required> array|string $pattern ]
94+
Parameter #1 [ <required> array|string $replacement ]
9595
Parameter #2 [ <required> array|string $subject ]
9696
Parameter #3 [ <optional> int $limit = -1 ]
9797
Parameter #4 [ <optional> &$count = null ]
@@ -101,8 +101,8 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
101101
Function [ <internal:pcre> function preg_filter ] {
102102

103103
- Parameters [5] {
104-
Parameter #0 [ <required> array|string $regex ]
105-
Parameter #1 [ <required> array|string $replace ]
104+
Parameter #1 [ <required> array|string $pattern ]
105+
Parameter #1 [ <required> array|string $replacement ]
106106
Parameter #2 [ <required> array|string $subject ]
107107
Parameter #3 [ <optional> int $limit = -1 ]
108108
Parameter #4 [ <optional> &$count = null ]
@@ -112,7 +112,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
112112
Function [ <internal:pcre> function preg_replace_callback ] {
113113

114114
- Parameters [6] {
115-
Parameter #0 [ <required> array|string $regex ]
115+
Parameter #1 [ <required> array|string $pattern ]
116116
Parameter #1 [ <required> callable $callback ]
117117
Parameter #2 [ <required> array|string $subject ]
118118
Parameter #3 [ <optional> int $limit = -1 ]
@@ -146,15 +146,15 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
146146

147147
- Parameters [2] {
148148
Parameter #0 [ <required> string $str ]
149-
Parameter #1 [ <optional> ?string $delim_char = null ]
149+
Parameter #1 [ <optional> ?string $delimiter = null ]
150150
}
151151
- Return [ string ]
152152
}
153153
Function [ <internal:pcre> function preg_grep ] {
154154

155155
- Parameters [3] {
156156
Parameter #0 [ <required> string $regex ]
157-
Parameter #1 [ <required> array $input ]
157+
Parameter #1 [ <required> array $array ]
158158
Parameter #2 [ <optional> int $flags = 0 ]
159159
}
160160
- Return [ array|false ]

0 commit comments

Comments
 (0)