[wp-trac] [WordPress Trac] #51553: PHP 8.0: code improvements to allow for named parameters in function calls

WordPress Trac noreply at wordpress.org
Thu Sep 2 19:43:08 UTC 2021


#51553: PHP 8.0: code improvements to allow for named parameters in function calls
-------------------------------------------------+-------------------------
 Reporter:  jrf                                  |       Owner:
                                                 |  hellofromTonya
     Type:  task (blessed)                       |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.9
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  php8 has-patch needs-codex early     |     Focuses:  coding-
  needs-dev-note commit                          |  standards
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 @azaozz and I reviewed the commenting and refined it a wee bit more:

 - Add `@since 5.9.0` with the renamed param and reason. For example:
 {{{
 * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP
 8 named param.
 }}}
 - When reassigning to the original variable, change the inline comment to
 remove the ticket number and a little tweak to the wording. For example:
 {{{
         /**
          * 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 $item        The current WP_Post object.
          * @param string  $column_name The current column name.
          */
         public function column_default( $item, $column_name ) {
                 // Restores the more descriptive, specific name for use
 within this method.
                 $post = $item;
 }}}

 The inline message is there to provide context of why the reassignment.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51553#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list