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/src/wp-includes/formatting.php

    r51624 r51657  
    31143114    $text = preg_replace_callback(
    31153115        '|<a (.+?)>|i',
    3116         function( $matches ) {
     3116        static function( $matches ) {
    31173117            return wp_rel_callback( $matches, 'nofollow' );
    31183118        },
     
    31483148    $text = preg_replace_callback(
    31493149        '|<a (.+?)>|i',
    3150         function( $matches ) {
     3150        static function( $matches ) {
    31513151            return wp_rel_callback( $matches, 'nofollow ugc' );
    31523152        },
Note: See TracChangeset for help on using the changeset viewer.