Make WordPress Core


Ignore:
Timestamp:
08/26/2021 12:57:08 PM (5 months 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/plural-form-function.php

    r48790 r51657  
    88 */
    99function tests_make_plural_form_function( $nplurals, $expression ) {
    10     $closure = function ( $n ) use ( $nplurals, $expression ) {
     10    $closure = static function ( $n ) use ( $nplurals, $expression ) {
    1111        $expression = str_replace( 'n', $n, $expression );
    1212
Note: See TracChangeset for help on using the changeset viewer.