Make WordPress Core


Ignore:
Timestamp:
08/26/2021 12:57:08 PM (3 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-content/themes/twentytwenty/classes/class-twentytwenty-customize.php

    r51322 r51657  
    187187                        'description'     => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ),
    188188                        'mode'            => 'hue',
    189                         'active_callback' => function() use ( $wp_customize ) {
     189                        'active_callback' => static function() use ( $wp_customize ) {
    190190                            return ( 'custom' === $wp_customize->get_setting( 'accent_hue_active' )->value() );
    191191                        },
Note: See TracChangeset for help on using the changeset viewer.