Make WordPress Core


Ignore:
Timestamp:
09/14/2023 12:44:23 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Restore more descriptive variable names in a few class methods.

When various methods parameters in child classes were renamed to $item to match the parent class for PHP 8 named parameter support, most of the methods restored the more descriptive, specific name at the beginning for better readability, with several exceptions for methods consisting only of a few lines.

To avoid confusion about why some methods do that and some don't, this commit aims to bring more consistency to the code, specifically in list tables' ::column_default() methods.

Follow-up to [51728], [51737], [51786].

See #58831.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php

    r56450 r56586  
    459459     */
    460460    public function column_default( $item, $column_name ) {
     461        // Restores the more descriptive, specific name for use within this method.
     462        $user = $item;
     463
    461464        /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
    462         echo apply_filters(
    463             'manage_users_custom_column',
    464             '', // Custom column output. Default empty.
    465             $column_name,
    466             $item->ID // User ID.
    467         );
     465        echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
    468466    }
    469467
     
    520518
    521519        // Restores the more descriptive, specific name for use within this method.
    522         $user         = $item;
     520        $user = $item;
     521
    523522        $super_admins = get_super_admins();
    524 
    525         $actions = array();
     523        $actions      = array();
    526524
    527525        if ( current_user_can( 'edit_user', $user->ID ) ) {
Note: See TracChangeset for help on using the changeset viewer.