Make WordPress Core


Ignore:
Timestamp:
05/17/2023 10:44:21 PM (21 months ago)
Author:
westonruter
Message:

General: Use static on closures whenever $this is not used to avoid memory leaks.

Props westonruter, jrf, spacedmonkey.
Fixes #58323.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-server.php

    r55562 r55822  
    938938     */
    939939    public function test_link_embedding_returning_wp_error() {
    940         $return_wp_error = function() {
     940        $return_wp_error = static function() {
    941941            return new WP_Error( 'some-error', 'This is not valid!' );
    942942        };
     
    21892189                array(
    21902190                    'methods'             => \WP_REST_Server::READABLE,
    2191                     'callback'            => function() {
     2191                    'callback'            => static function() {
    21922192                        return new \WP_REST_Response( INF );
    21932193                    },
Note: See TracChangeset for help on using the changeset viewer.