Code Modernization: Rename parameters that use reserved keywords in `wp-includes/pomo/streams.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:
 * `POMO_Reader::substr()`
 * `POMO_Reader::strlen()`
 * `POMO_Reader::str_split()`

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].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@54960


git-svn-id: http://core.svn.wordpress.org/trunk@54512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-12-12 20:21:12 +00:00
parent 68f2c6cd13
commit 41924d88a3
2 changed files with 14 additions and 14 deletions

View File

@ -85,46 +85,46 @@ if ( ! class_exists( 'POMO_Reader', false ) ) :
}
/**
* @param string $string
* @param string $input_string
* @param int $start
* @param int $length
* @return string
*/
public function substr( $string, $start, $length ) {
public function substr( $input_string, $start, $length ) {
if ( $this->is_overloaded ) {
return mb_substr( $string, $start, $length, 'ascii' );
return mb_substr( $input_string, $start, $length, 'ascii' );
} else {
return substr( $string, $start, $length );
return substr( $input_string, $start, $length );
}
}
/**
* @param string $string
* @param string $input_string
* @return int
*/
public function strlen( $string ) {
public function strlen( $input_string ) {
if ( $this->is_overloaded ) {
return mb_strlen( $string, 'ascii' );
return mb_strlen( $input_string, 'ascii' );
} else {
return strlen( $string );
return strlen( $input_string );
}
}
/**
* @param string $string
* @param string $input_string
* @param int $chunk_size
* @return array
*/
public function str_split( $string, $chunk_size ) {
public function str_split( $input_string, $chunk_size ) {
if ( ! function_exists( 'str_split' ) ) {
$length = $this->strlen( $string );
$length = $this->strlen( $input_string );
$out = array();
for ( $i = 0; $i < $length; $i += $chunk_size ) {
$out[] = $this->substr( $string, $i, $chunk_size );
$out[] = $this->substr( $input_string, $i, $chunk_size );
}
return $out;
} else {
return str_split( $string, $chunk_size );
return str_split( $input_string, $chunk_size );
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-54959';
$wp_version = '6.2-alpha-54960';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.