Make WordPress Core


Ignore:
Timestamp:
08/26/2021 12:57:08 PM (4 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Use static closures when not using $this.

When a closure does not use $this, it can be made static for improved performance.

Static closures are supported in PHP since PHP 5.4. ​

Props jrf, hellofromTonya, swissspidy, SergeyBiryukov.
See #53359.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php

    r51286 r51657  
    8686                        'description'       => __( 'Serialized widget form data to encode into instance settings.' ),
    8787                        'type'              => 'string',
    88                         'sanitize_callback' => function( $string ) {
     88                        'sanitize_callback' => static function( $string ) {
    8989                            $array = array();
    9090                            wp_parse_str( $string, $array );
Note: See TracChangeset for help on using the changeset viewer.