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/tests/phpunit/tests/rest-api/rest-widgets-controller.php

    r51568 r51657  
    109109            'testwidget',
    110110            'WP test widget',
    111             function () {
     111            static function () {
    112112                $settings = get_option( 'widget_testwidget' );
    113113
     
    128128            'testwidget',
    129129            'WP test widget',
    130             function () {
     130            static function () {
    131131                $settings = wp_parse_args(
    132132                    get_option( 'widget_testwidget' ),
Note: See TracChangeset for help on using the changeset viewer.