Make WordPress Core


Ignore:
Timestamp:
04/20/2022 10:44:46 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/upgrade.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 $public parameter to $is_public in wp_install().

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

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

File:
1 edited

Legend:

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

    r53011 r53230  
    3232     * @param string $user_name     User's username.
    3333     * @param string $user_email    User's email.
    34      * @param bool   $public        Whether site is public.
     34     * @param bool   $is_public     Whether the site is public.
    3535     * @param string $deprecated    Optional. Not used.
    3636     * @param string $user_password Optional. User's chosen password. Default empty (random password).
     
    4545     * }
    4646     */
    47     function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
     47    function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecated = '', $user_password = '', $language = '' ) {
    4848        if ( ! empty( $deprecated ) ) {
    4949            _deprecated_argument( __FUNCTION__, '2.6.0' );
     
    5858        update_option( 'blogname', $blog_title );
    5959        update_option( 'admin_email', $user_email );
    60         update_option( 'blog_public', $public );
     60        update_option( 'blog_public', $is_public );
    6161
    6262        // Freshness of site - in the future, this could get more specific about actions taken, perhaps.
     
    7272
    7373        // If not a public site, don't ping.
    74         if ( ! $public ) {
     74        if ( ! $is_public ) {
    7575            update_option( 'default_pingback_flag', 0 );
    7676        }
Note: See TracChangeset for help on using the changeset viewer.