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/tests/phpunit/tests/dependencies/wpInlineScriptTag.php

    r50409 r51657  
    8181        add_filter(
    8282            'wp_inline_script_attributes',
    83             function ( $attributes ) {
     83            static function ( $attributes ) {
    8484                if ( isset( $attributes['id'] ) && 'utils-js-extra' === $attributes['id'] ) {
    8585                    $attributes['async'] = true;
Note: See TracChangeset for help on using the changeset viewer.