Make WordPress Core


Ignore:
Timestamp:
05/17/2023 10:44:21 PM (16 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/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php

    r53760 r55822  
    793793            'context'     => array( 'view', 'edit', 'embed' ),
    794794            'arg_options' => array(
    795                 'sanitize_callback' => function ( $value ) {
     795                'sanitize_callback' => static function ( $value ) {
    796796                    return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
    797797                },
     
    874874            'context'     => array( 'view', 'edit', 'embed' ),
    875875            'arg_options' => array(
    876                 'sanitize_callback' => function ( $value ) {
     876                'sanitize_callback' => static function ( $value ) {
    877877                    return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
    878878                },
Note: See TracChangeset for help on using the changeset viewer.