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/cron.php

    r51619 r51657  
    10561056        add_filter(
    10571057            'pre_update_option_cron',
    1058             function() {
     1058            static function() {
    10591059                return get_option( 'cron' );
    10601060            }
     
    10761076        add_filter(
    10771077            'pre_update_option_cron',
    1078             function() {
     1078            static function() {
    10791079                return get_option( 'cron' );
    10801080            }
     
    10991099        add_filter(
    11001100            'pre_update_option_cron',
    1101             function() {
     1101            static function() {
    11021102                return get_option( 'cron' );
    11031103            }
     
    11231123        add_filter(
    11241124            'pre_update_option_cron',
    1125             function() {
     1125            static function() {
    11261126                return get_option( 'cron' );
    11271127            }
Note: See TracChangeset for help on using the changeset viewer.