[wp-trac] [WordPress Trac] #53978: Non-static method 'get_default_primary_column_name' should not be called statically

WordPress Trac noreply at wordpress.org
Mon Aug 23 11:35:11 UTC 2021


#53978: Non-static method 'get_default_primary_column_name' should not be called
statically
---------------------------------+-----------------------------
 Reporter:  volodymyrkolesnykov  |      Owner:  (none)
     Type:  defect (bug)         |     Status:  new
 Priority:  normal               |  Milestone:  Awaiting Review
Component:  General              |    Version:  5.8
 Severity:  normal               |   Keywords:
  Focuses:  administration       |
---------------------------------+-----------------------------
 `WP_List_Table::get_primary_column_name()` invokes
 `get_default_primary_column_name()` as a static method, although it is not
 static:

 {{{
 $default = $this->get_default_primary_column_name();

 // If the primary column doesn't exist,
 // fall back to the first non-checkbox column.
 if ( ! isset( $columns[ $default ] ) ) {
         $default = self::get_default_primary_column_name();
 }
 }}}

 Also, the second call to `get_default_primary_column_name()` probably does
 not make sense because it is going to return the same value as `$default`
 already has. And, unless I am missing something, the entire `if` clause
 can be dropped. If so, I am happy to create a PR.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53978>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list