mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-09 03:30:06 +00:00
Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::column_default().
Matches the method signatures of the parent class and each child class. Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match. For readability: - `@since` clearly specifies the original parameter name and its new name as well as why the change happened - in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made. Follow-up to [15632], [30679], [31210], [32740], [32753], [32754], [32755], [32756], [32757]. Props jrf, hellofromTonya, @sergeybiryukov, @azaozz, @desrosj, @johnbillion See #51553. git-svn-id: https://develop.svn.wordpress.org/trunk@51728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1235,11 +1235,15 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* Handles the default column output.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named param.
|
||||
*
|
||||
* @param WP_Post $post The current WP_Post object.
|
||||
* @param WP_Post $item The current WP_Post object.
|
||||
* @param string $column_name The current column name.
|
||||
*/
|
||||
public function column_default( $post, $column_name ) {
|
||||
public function column_default( $item, $column_name ) {
|
||||
// Restores the more descriptive, specific name for use within this method.
|
||||
$post = $item;
|
||||
|
||||
if ( 'categories' === $column_name ) {
|
||||
$taxonomy = 'category';
|
||||
} elseif ( 'tags' === $column_name ) {
|
||||
|
||||
Reference in New Issue
Block a user