Make WordPress Core


Ignore:
Timestamp:
03/30/2022 10:43:08 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-wp-importer.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 $text in WP_Importer::min_whitespace().

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-importer.php

    r50692 r53029  
    239239
    240240    /**
    241      * Replace newlines, tabs, and multiple spaces with a single space
    242      *
    243      * @param string $string
     241     * Replace newlines, tabs, and multiple spaces with a single space.
     242     *
     243     * @param string $text
    244244     * @return string
    245245     */
    246     public function min_whitespace( $string ) {
    247         return preg_replace( '|[\r\n\t ]+|', ' ', $string );
     246    public function min_whitespace( $text ) {
     247        return preg_replace( '|[\r\n\t ]+|', ' ', $text );
    248248    }
    249249
Note: See TracChangeset for help on using the changeset viewer.