summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2020-10-02 00:20:45 +0200
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-10-02 11:55:23 +0200
commit6b00196e04d29479412e1de6dabc5b8a62709686 (patch)
tree65576e989a40e084961fc4024b9b670bfa7899b2
parent109fb3e57de34cbbd948d582474e83c4cbe35a96 (diff)
downloadphp-git-6b00196e04d29479412e1de6dabc5b8a62709686.tar.gz
Review parameter names in ext/pcre
Closes GH-6259
-rw-r--r--ext/pcre/php_pcre.c2
-rw-r--r--ext/pcre/php_pcre.stub.php18
-rw-r--r--ext/pcre/php_pcre_arginfo.h18
-rw-r--r--ext/pcre/tests/bug21732.phpt2
-rw-r--r--ext/pcre/tests/preg_grep_error1.phpt4
-rw-r--r--ext/pcre/tests/preg_match_all_error3.phpt2
-rw-r--r--ext/pcre/tests/preg_replace_error1.phpt2
-rw-r--r--ext/pcre/tests/preg_replace_error2.phpt4
-rw-r--r--ext/standard/tests/streams/bug61115.phpt2
-rw-r--r--sapi/cli/tests/006.phpt20
10 files changed, 37 insertions, 37 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 42c423e6bd..ee340829ee 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -2295,7 +2295,7 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, bool is_filter)
/* If replace is an array then the regex argument needs to also be an array */
if (replace_ht && !regex_ht) {
- zend_argument_type_error(1, "must be of type array when argument #2 ($replace) is an array, string given");
+ zend_argument_type_error(1, "must be of type array when argument #2 ($replacement) is an array, string given");
RETURN_THROWS();
}
diff --git a/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php
index f620d119fd..b2862a2f62 100644
--- a/ext/pcre/php_pcre.stub.php
+++ b/ext/pcre/php_pcre.stub.php
@@ -2,29 +2,29 @@
/** @generate-function-entries */
-/** @param array $subpatterns */
-function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false {}
+/** @param array $matches */
+function preg_match(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}
-/** @param array $subpatterns */
-function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false|null {}
+/** @param array $matches */
+function preg_match_all(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false|null {}
/** @param int $count */
-function preg_replace(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
+function preg_replace(string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
/** @param int $count */
-function preg_filter(string|array $regex, string|array $replace, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
+function preg_filter(string|array $pattern, string|array $replacement, string|array $subject, int $limit = -1, &$count = null): string|array|null {}
/** @param int $count */
-function preg_replace_callback(string|array $regex, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
+function preg_replace_callback(string|array $pattern, callable $callback, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
/** @param int $count */
function preg_replace_callback_array(array $pattern, string|array $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {}
-function preg_quote(string $str, ?string $delim_char = null): string {}
+function preg_quote(string $str, ?string $delimiter = null): string {}
-function preg_grep(string $regex, array $input, int $flags = 0): array|false {}
+function preg_grep(string $pattern, array $array, int $flags = 0): array|false {}
function preg_last_error(): int {}
diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h
index d1d816cfa0..c53f35559e 100644
--- a/ext/pcre/php_pcre_arginfo.h
+++ b/ext/pcre/php_pcre_arginfo.h
@@ -1,10 +1,10 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 8270971708afa7fa9d82bec0f84c66cc8283f17d */
+ * Stub hash: 2e5a9edc9635edd4f5a00e9d888fb34c1746a5b8 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
- ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, subpatterns, "null")
+ ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matches, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
@@ -12,14 +12,14 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match_all, 0, 2, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
- ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, subpatterns, "null")
+ ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matches, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
- ZEND_ARG_TYPE_MASK(0, regex, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
- ZEND_ARG_TYPE_MASK(0, replace, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
+ ZEND_ARG_TYPE_MASK(0, pattern, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
+ ZEND_ARG_TYPE_MASK(0, replacement, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, count, "null")
@@ -28,7 +28,7 @@ ZEND_END_ARG_INFO()
#define arginfo_preg_filter arginfo_preg_replace
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace_callback, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
- ZEND_ARG_TYPE_MASK(0, regex, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
+ ZEND_ARG_TYPE_MASK(0, pattern, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, limit, IS_LONG, 0, "-1")
@@ -53,12 +53,12 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_quote, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delim_char, IS_STRING, 1, "null")
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, delimiter, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_grep, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
- ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
- ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt
index 6d162d159b..02a13713e2 100644
--- a/ext/pcre/tests/bug21732.phpt
+++ b/ext/pcre/tests/bug21732.phpt
@@ -17,7 +17,7 @@ try {
var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
?>
--EXPECT--
-preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
+preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
array(4) {
[0]=>
string(5) "abcde"
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
index 1215c24f00..3079c0b4b0 100644
--- a/ext/pcre/tests/preg_grep_error1.phpt
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -56,7 +56,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
bool(false)
Arg value is Array
-preg_grep(): Argument #1 ($regex) must be of type string, array given
+preg_grep(): Argument #1 ($pattern) must be of type string, array given
Arg value is /[a-zA-Z]/
array(2) {
@@ -65,5 +65,5 @@ array(2) {
[2]=>
string(4) "test"
}
-preg_grep(): Argument #1 ($regex) must be of type string, stdClass given
+preg_grep(): Argument #1 ($pattern) must be of type string, stdClass given
Done
diff --git a/ext/pcre/tests/preg_match_all_error3.phpt b/ext/pcre/tests/preg_match_all_error3.phpt
index 11427b7c68..a78619bdd7 100644
--- a/ext/pcre/tests/preg_match_all_error3.phpt
+++ b/ext/pcre/tests/preg_match_all_error3.phpt
@@ -17,7 +17,7 @@ echo "Done";
--EXPECTF--
*** Testing preg_match_all() : error conditions ***
-Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($subpatterns) cannot be passed by reference in %s:%d
+Fatal error: Uncaught Error: preg_match_all(): Argument #3 ($matches) cannot be passed by reference in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
index e654240f37..ccd3554745 100644
--- a/ext/pcre/tests/preg_replace_error1.phpt
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -56,4 +56,4 @@ string(1) "a"
Arg value is /[a-zA-Z]/
string(1) "1"
-preg_replace(): Argument #1 ($regex) must be of type array|string, stdClass given
+preg_replace(): Argument #1 ($pattern) must be of type array|string, stdClass given
diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt
index c4503aafd1..4b162061b3 100644
--- a/ext/pcre/tests/preg_replace_error2.phpt
+++ b/ext/pcre/tests/preg_replace_error2.phpt
@@ -35,6 +35,6 @@ Arg value is: this is a string
string(64) "this is a stringthis is a stringthis is a stringthis is a string"
Arg value is: Array
-preg_replace(): Argument #1 ($regex) must be of type array when argument #2 ($replace) is an array, string given
-preg_replace(): Argument #2 ($replace) must be of type array|string, stdClass given
+preg_replace(): Argument #1 ($pattern) must be of type array when argument #2 ($replacement) is an array, string given
+preg_replace(): Argument #2 ($replacement) must be of type array|string, stdClass given
Done
diff --git a/ext/standard/tests/streams/bug61115.phpt b/ext/standard/tests/streams/bug61115.phpt
index cb11e23d38..9dfc27a943 100644
--- a/ext/standard/tests/streams/bug61115.phpt
+++ b/ext/standard/tests/streams/bug61115.phpt
@@ -14,4 +14,4 @@ try {
}
?>
--EXPECT--
-preg_replace(): Argument #2 ($replace) must be of type array|string, Closure given
+preg_replace(): Argument #2 ($replacement) must be of type array|string, Closure given
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index 77a5667bda..3a55f99844 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -70,7 +70,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
- Parameters [5] {
Parameter #0 [ <required> string $pattern ]
Parameter #1 [ <required> string $subject ]
- Parameter #2 [ <optional> &$subpatterns = null ]
+ Parameter #2 [ <optional> &$matches = null ]
Parameter #3 [ <optional> int $flags = 0 ]
Parameter #4 [ <optional> int $offset = 0 ]
}
@@ -81,7 +81,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
- Parameters [5] {
Parameter #0 [ <required> string $pattern ]
Parameter #1 [ <required> string $subject ]
- Parameter #2 [ <optional> &$subpatterns = null ]
+ Parameter #2 [ <optional> &$matches = null ]
Parameter #3 [ <optional> int $flags = 0 ]
Parameter #4 [ <optional> int $offset = 0 ]
}
@@ -90,8 +90,8 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_replace ] {
- Parameters [5] {
- Parameter #0 [ <required> array|string $regex ]
- Parameter #1 [ <required> array|string $replace ]
+ Parameter #0 [ <required> array|string $pattern ]
+ Parameter #1 [ <required> array|string $replacement ]
Parameter #2 [ <required> array|string $subject ]
Parameter #3 [ <optional> int $limit = -1 ]
Parameter #4 [ <optional> &$count = null ]
@@ -101,8 +101,8 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_filter ] {
- Parameters [5] {
- Parameter #0 [ <required> array|string $regex ]
- Parameter #1 [ <required> array|string $replace ]
+ Parameter #0 [ <required> array|string $pattern ]
+ Parameter #1 [ <required> array|string $replacement ]
Parameter #2 [ <required> array|string $subject ]
Parameter #3 [ <optional> int $limit = -1 ]
Parameter #4 [ <optional> &$count = null ]
@@ -112,7 +112,7 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_replace_callback ] {
- Parameters [6] {
- Parameter #0 [ <required> array|string $regex ]
+ Parameter #0 [ <required> array|string $pattern ]
Parameter #1 [ <required> callable $callback ]
Parameter #2 [ <required> array|string $subject ]
Parameter #3 [ <optional> int $limit = -1 ]
@@ -146,15 +146,15 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
- Parameters [2] {
Parameter #0 [ <required> string $str ]
- Parameter #1 [ <optional> ?string $delim_char = null ]
+ Parameter #1 [ <optional> ?string $delimiter = null ]
}
- Return [ string ]
}
Function [ <internal:pcre> function preg_grep ] {
- Parameters [3] {
- Parameter #0 [ <required> string $regex ]
- Parameter #1 [ <required> array $input ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> array $array ]
Parameter #2 [ <optional> int $flags = 0 ]
}
- Return [ array|false ]