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/l10n/loadScriptTextdomain.php

    r50456 r51657  
    5050                array(
    5151                    'site_url',
    52                     function ( $site_url ) {
     52                    static function ( $site_url ) {
    5353                        return $site_url . '/wp';
    5454                    },
     
    6363                array(
    6464                    'plugins_url',
    65                     function () {
     65                    static function () {
    6666                        return 'https://plugins.example.com';
    6767                    },
     
    7676                array(
    7777                    'content_url',
    78                     function () {
     78                    static function () {
    7979                        return 'https://content.example.com';
    8080                    },
     
    8989                array(
    9090                    'content_url',
    91                     function () {
     91                    static function () {
    9292                        return '/';
    9393                    },
     
    102102                array(
    103103                    'plugins_url',
    104                     function () {
     104                    static function () {
    105105                        return '/';
    106106                    },
     
    115115                array(
    116116                    'site_url',
    117                     function () {
     117                    static function () {
    118118                        return '/wp';
    119119                    },
Note: See TracChangeset for help on using the changeset viewer.