Skip to content

Commit 4f813e3

Browse files
Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/compat/mbSubstr.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit renames the `$string` parameter to `$input_string` in the unit tests for `mb_substr()` polyfill. Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #56788. git-svn-id: https://develop.svn.wordpress.org/trunk@55037 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7cd8e57 commit 4f813e3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/phpunit/tests/compat/mbSubstr.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ public function test_mb_substr_availability() {
1919
/**
2020
* @dataProvider utf8_substrings
2121
*/
22-
public function test_mb_substr( $string, $start, $length, $expected_character_substring ) {
23-
$this->assertSame( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );
22+
public function test_mb_substr( $input_string, $start, $length, $expected_character_substring ) {
23+
$this->assertSame( $expected_character_substring, _mb_substr( $input_string, $start, $length, 'UTF-8' ) );
2424
}
2525

2626
/**
2727
* @dataProvider utf8_substrings
2828
*/
29-
public function test_mb_substr_via_regex( $string, $start, $length, $expected_character_substring ) {
29+
public function test_mb_substr_via_regex( $input_string, $start, $length, $expected_character_substring ) {
3030
_wp_can_use_pcre_u( false );
31-
$this->assertSame( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );
31+
$this->assertSame( $expected_character_substring, _mb_substr( $input_string, $start, $length, 'UTF-8' ) );
3232
_wp_can_use_pcre_u( 'reset' );
3333
}
3434

3535
/**
3636
* @dataProvider utf8_substrings
3737
*/
38-
public function test_8bit_mb_substr( $string, $start, $length, $expected_character_substring, $expected_byte_substring ) {
39-
$this->assertSame( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) );
38+
public function test_8bit_mb_substr( $input_string, $start, $length, $expected_character_substring, $expected_byte_substring ) {
39+
$this->assertSame( $expected_byte_substring, _mb_substr( $input_string, $start, $length, '8bit' ) );
4040
}
4141

4242
/**
@@ -47,49 +47,49 @@ public function test_8bit_mb_substr( $string, $start, $length, $expected_charact
4747
public function utf8_substrings() {
4848
return array(
4949
array(
50-
'string' => 'баба',
50+
'input_string' => 'баба',
5151
'start' => 0,
5252
'length' => 3,
5353
'expected_character_substring' => 'баб',
5454
'expected_byte_substring' => "б\xD0",
5555
),
5656
array(
57-
'string' => 'баба',
57+
'input_string' => 'баба',
5858
'start' => 0,
5959
'length' => -1,
6060
'expected_character_substring' => 'баб',
6161
'expected_byte_substring' => "баб\xD0",
6262
),
6363
array(
64-
'string' => 'баба',
64+
'input_string' => 'баба',
6565
'start' => 1,
6666
'length' => null,
6767
'expected_character_substring' => 'аба',
6868
'expected_byte_substring' => "\xB1аба",
6969
),
7070
array(
71-
'string' => 'баба',
71+
'input_string' => 'баба',
7272
'start' => -3,
7373
'length' => null,
7474
'expected_character_substring' => 'аба',
7575
'expected_byte_substring' => "\xB1а",
7676
),
7777
array(
78-
'string' => 'баба',
78+
'input_string' => 'баба',
7979
'start' => -3,
8080
'length' => 2,
8181
'expected_character_substring' => 'аб',
8282
'expected_byte_substring' => "\xB1\xD0",
8383
),
8484
array(
85-
'string' => 'баба',
85+
'input_string' => 'баба',
8686
'start' => -1,
8787
'length' => 2,
8888
'expected_character_substring' => 'а',
8989
'expected_byte_substring' => "\xB0",
9090
),
9191
array(
92-
'string' => 'I am your баба',
92+
'input_string' => 'I am your баба',
9393
'start' => 0,
9494
'length' => 11,
9595
'expected_character_substring' => 'I am your б',

0 commit comments

Comments
 (0)