Make WordPress Core

Changeset 53014


Ignore:
Timestamp:
03/29/2022 01:19:23 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-wp-filesystem-base.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 $echo parameter to $verbose in WP_Filesystem_Base::find_base_dir() and ::get_base_dir(), and updates the documentation accordingly. This matches the class property of the same name.

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

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

File:
1 edited

Legend:

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

    r52332 r53014  
    130130     * @see WP_Filesystem_Base::wp_lang_dir()
    131131     *
    132      * @param string $base The folder to start searching from.
    133      * @param bool   $echo True to display debug information.
    134      *                     Default false.
     132     * @param string $base    Optional. The folder to start searching from. Default '.'.
     133     * @param bool   $verbose Optional. True to display debug information. Default false.
    135134     * @return string The location of the remote path.
    136135     */
    137     public function find_base_dir( $base = '.', $echo = false ) {
     136    public function find_base_dir( $base = '.', $verbose = false ) {
    138137        _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
    139         $this->verbose = $echo;
     138        $this->verbose = $verbose;
    140139        return $this->abspath();
    141140    }
     
    152151     * @see WP_Filesystem_Base::wp_lang_dir()
    153152     *
    154      * @param string $base The folder to start searching from.
    155      * @param bool   $echo True to display debug information.
     153     * @param string $base    Optional. The folder to start searching from. Default '.'.
     154     * @param bool   $verbose Optional. True to display debug information. Default false.
    156155     * @return string The location of the remote path.
    157156     */
    158     public function get_base_dir( $base = '.', $echo = false ) {
     157    public function get_base_dir( $base = '.', $verbose = false ) {
    159158        _deprecated_function( __FUNCTION__, '2.7.0', 'WP_Filesystem_Base::abspath() or WP_Filesystem_Base::wp_*_dir()' );
    160         $this->verbose = $echo;
     159        $this->verbose = $verbose;
    161160        return $this->abspath();
    162161    }
Note: See TracChangeset for help on using the changeset viewer.