Make WordPress Core

Changeset 46143


Ignore:
Timestamp:
09/15/2019 11:49:51 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Code Modernisation: Replace call_user_func_array() in wp-includes/class-wp-walker.php with dynamic function calls.

Props jrf.
See #47678.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-walker.php

    r45640 r46143  
    142142                }
    143143
    144                 $cb_args = array_merge( array( &$output, $element, $depth ), $args );
    145                 call_user_func_array( array( $this, 'start_el' ), $cb_args );
     144                $this->start_el( $output, $element, $depth, ...array_values( $args ) );
    146145
    147146                // descend only when the depth is right and there are childrens for this element
    … …  
    153152                                        $newlevel = true;
    154153                                        //start the child delimiter
    155                                         $cb_args = array_merge( array( &$output, $depth ), $args );
    156                                         call_user_func_array( array( $this, 'start_lvl' ), $cb_args );
     154                                        $this->start_lvl( $output, $depth, ...array_values( $args ) );
    157155                                }
    158156                                $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
    … …  
    163161                if ( isset( $newlevel ) && $newlevel ) {
    164162                        //end the child delimiter
    165                         $cb_args = array_merge( array( &$output, $depth ), $args );
    166                         call_user_func_array( array( $this, 'end_lvl' ), $cb_args );
     163                        $this->end_lvl( $output, $depth, ...array_values( $args ) );
    167164                }
    168165
    169166                //end this element
    170                 $cb_args = array_merge( array( &$output, $element, $depth ), $args );
    171                 call_user_func_array( array( $this, 'end_el' ), $cb_args );
     167                $this->end_el( $output, $element, $depth, ...array_values( $args ) );
    172168        }
    173169
Note: See TracChangeset for help on using the changeset viewer.