mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Code Modernization: Fix parameter name mismatches for parent/child classes in WP_List_Table::handle_row_actions().
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 [32644], [32664], [32798], [38489], [49183], [49197]. Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion. See #51553. git-svn-id: https://develop.svn.wordpress.org/trunk@51737 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1402,18 +1402,21 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
* Generates and displays row action links.
|
||||
*
|
||||
* @since 4.3.0
|
||||
* @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
|
||||
*
|
||||
* @param WP_Post $post Post being acted upon.
|
||||
* @param WP_Post $item Post being acted upon.
|
||||
* @param string $column_name Current column name.
|
||||
* @param string $primary Primary column name.
|
||||
* @return string Row actions output for posts, or an empty string
|
||||
* if the current column is not the primary column.
|
||||
*/
|
||||
protected function handle_row_actions( $post, $column_name, $primary ) {
|
||||
protected function handle_row_actions( $item, $column_name, $primary ) {
|
||||
if ( $primary !== $column_name ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Restores the more descriptive, specific name for use within this method.
|
||||
$post = $item;
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
$can_edit_post = current_user_can( 'edit_post', $post->ID );
|
||||
$actions = array();
|
||||
|
||||
Reference in New Issue
Block a user