Make WordPress Core

Changeset 60174


Ignore:
Timestamp:
04/18/2025 08:26:20 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Correct $site_id parameter default values in WP_User.

This commit corrects the default $site_id parameter values used throughout the WP_User class to bring them in line with their int doctypes (and the doctypes of the functions used internally by the affected class methods).

More specifically,

  • __construct(): $site_id = '' changed to $site_id = 0
  • init(): $site_id = '' changed to $site_id = 0
  • for_blog(): $blog_id = '' changed to $blog_id = 0
  • for_site(): $site_id = '' changed to $site_id = 0

Follow-up to [12796], [15566], [18597], [41624].

Props justlevine.
See #63268.

File:
1 edited

Legend:

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

    r59927 r60174  
    126126     * @param int                         $site_id Optional Site ID, defaults to current site.
    127127     */
    128     public function __construct( $id = 0, $name = '', $site_id = '' ) {
     128    public function __construct( $id = 0, $name = '', $site_id = 0 ) {
    129129        global $wpdb;
    130130
     
    176176     * @param int    $site_id Optional. The site ID to initialize for.
    177177     */
    178     public function init( $data, $site_id = '' ) {
     178    public function init( $data, $site_id = 0 ) {
    179179        if ( ! isset( $data->ID ) ) {
    180180            $data->ID = 0;
     
    853853     * @param int $blog_id Optional. Site ID, defaults to current site.
    854854     */
    855     public function for_blog( $blog_id = '' ) {
     855    public function for_blog( $blog_id = 0 ) {
    856856        _deprecated_function( __METHOD__, '4.9.0', 'WP_User::for_site()' );
    857857
     
    868868     * @param int $site_id Site ID to initialize user capabilities for. Default is the current site.
    869869     */
    870     public function for_site( $site_id = '' ) {
     870    public function for_site( $site_id = 0 ) {
    871871        global $wpdb;
    872872
Note: See TracChangeset for help on using the changeset viewer.