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-pattern-directory-controller.php

    r51461 r51657  
    273273        add_filter(
    274274            'rest_prepare_block_pattern',
    275             function( $response ) {
     275            static function( $response ) {
    276276                return 'initial value';
    277277            }
     
    287287        add_filter(
    288288            'rest_prepare_block_pattern',
    289             function( $response ) {
     289            static function( $response ) {
    290290                return 'modified the cache';
    291291            },
Note: See TracChangeset for help on using the changeset viewer.