Make WordPress Core


Ignore:
Timestamp:
09/14/2023 12:44:23 PM (3 years 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-themes-list-table.php

    r56450 r56586  
    510510        public function column_cb( $item ) {
    511511                // Restores the more descriptive, specific name for use within this method.
    512                 $theme       = $item;
     512                $theme = $item;
     513
    513514                $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
    514515                ?>
    … …  
    879880         */
    880881        public function column_default( $item, $column_name ) {
     882                // Restores the more descriptive, specific name for use within this method.
     883                $theme = $item;
     884
     885                $stylesheet = $theme->get_stylesheet();
     886
    881887                /**
    882888                 * Fires inside each custom column of the Multisite themes list table.
    … …  
    888894                 * @param WP_Theme $theme       Current WP_Theme object.
    889895                 */
    890                 do_action(
    891                         'manage_themes_custom_column',
    892                         $column_name,
    893                         $item->get_stylesheet(), // Directory name of the theme.
    894                         $item // Theme object.
    895                 );
     896                do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
    896897        }
    897898
Note: See TracChangeset for help on using the changeset viewer.