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/includes/abstract-testcase.php

    r51608 r51657  
    720720        $expected = map_deep(
    721721            $expected,
    722             function ( $value ) {
     722            static function ( $value ) {
    723723                return str_replace( "\r\n", "\n", $value );
    724724            }
     
    727727        $actual = map_deep(
    728728            $actual,
    729             function ( $value ) {
     729            static function ( $value ) {
    730730                return str_replace( "\r\n", "\n", $value );
    731731            }
Note: See TracChangeset for help on using the changeset viewer.