Coding Standards: Include one space after `function` keyword for closures.

Note: This is enforced by WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/pull/2328 WPCS: PR #2328 Core: properly check formatting of function declaration statements].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56559


git-svn-id: http://core.svn.wordpress.org/trunk@56071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-09-12 15:23:18 +00:00
parent 251a9c7653
commit e5490118af
32 changed files with 45 additions and 45 deletions

View File

@ -31,7 +31,7 @@ $current_screen->is_block_editor( true );
// Default to is-fullscreen-mode to avoid jumps in the UI.
add_filter(
'admin_body_class',
static function( $classes ) {
static function ( $classes ) {
return "$classes is-fullscreen-mode";
}
);

View File

@ -483,7 +483,7 @@ class WP_Community_Events {
$future_wordcamps = array_filter(
$future_events,
static function( $wordcamp ) {
static function ( $wordcamp ) {
return 'wordcamp' === $wordcamp['type'];
}
);

View File

@ -42,7 +42,7 @@ class WP_Site_Health_Auto_Updates {
$tests = array_filter( $tests );
$tests = array_map(
static function( $test ) {
static function ( $test ) {
$test = (object) $test;
if ( empty( $test->severity ) ) {

View File

@ -2726,7 +2726,7 @@ function wp_opcache_invalidate_directory( $dir ) {
* with sub-directories represented as nested arrays.
* @param string $path Absolute path to the directory.
*/
$invalidate_directory = static function( $dirlist, $path ) use ( &$invalidate_directory ) {
$invalidate_directory = static function ( $dirlist, $path ) use ( &$invalidate_directory ) {
$path = trailingslashit( $path );
foreach ( $dirlist as $name => $details ) {

View File

@ -1805,7 +1805,7 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
$dirs = glob( $directory . '*', GLOB_ONLYDIR );
$dirs = array_filter(
$dirs,
static function( $dir ) {
static function ( $dir ) {
/*
* Skip any node_modules directories.
*

View File

@ -23,7 +23,7 @@ $title = __( 'Privacy' );
add_filter(
'admin_body_class',
static function( $body_class ) {
static function ( $body_class ) {
$body_class .= ' privacy-settings ';
return $body_class;

View File

@ -22,7 +22,7 @@ $title = __( 'Privacy Policy Guide' );
add_filter(
'admin_body_class',
static function( $body_class ) {
static function ( $body_class ) {
$body_class .= ' privacy-settings ';
return $body_class;

View File

@ -42,7 +42,7 @@ $current_screen->is_block_editor( true );
// Default to is-fullscreen-mode to avoid jumps in the UI.
add_filter(
'admin_body_class',
static function( $classes ) {
static function ( $classes ) {
return "$classes is-fullscreen-mode";
}
);

View File

@ -144,7 +144,7 @@ if ( 'grid' === $mode ) {
// Remove the error parameter added by deprecation of wp-admin/media.php.
add_filter(
'removable_query_args',
function() {
function () {
return array( 'error' );
},
10,

View File

@ -187,7 +187,7 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) {
'settings' => 'accent_hue',
'description' => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ),
'mode' => 'hue',
'active_callback' => static function() use ( $wp_customize ) {
'active_callback' => static function () use ( $wp_customize ) {
return ( 'custom' === $wp_customize->get_setting( 'accent_hue_active' )->value() );
},
)

View File

@ -92,7 +92,7 @@ if ( ! class_exists( 'Twenty_Twenty_One_Customize' ) ) {
array(
'capability' => 'edit_theme_options',
'default' => 'excerpt',
'sanitize_callback' => static function( $value ) {
'sanitize_callback' => static function ( $value ) {
return 'excerpt' === $value || 'full' === $value ? $value : 'excerpt';
},
)

View File

@ -153,7 +153,7 @@ class Twenty_Twenty_One_Dark_Mode {
array(
'section' => 'colors',
'priority' => 100,
'active_callback' => static function() {
'active_callback' => static function () {
return 127 >= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
},
)
@ -165,7 +165,7 @@ class Twenty_Twenty_One_Dark_Mode {
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => static function( $value ) {
'sanitize_callback' => static function ( $value ) {
return (bool) $value;
},
)
@ -188,7 +188,7 @@ class Twenty_Twenty_One_Dark_Mode {
'label' => esc_html__( 'Dark Mode support', 'twentytwentyone' ),
'priority' => 110,
'description' => $description,
'active_callback' => static function( $value ) {
'active_callback' => static function ( $value ) {
return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
},
)
@ -200,7 +200,7 @@ class Twenty_Twenty_One_Dark_Mode {
array(
'selector' => '#dark-mode-toggler',
'container_inclusive' => true,
'render_callback' => function() {
'render_callback' => function () {
$attrs = ( $this->switch_should_render() ) ? array() : array( 'style' => 'display:none;' );
$this->the_html( $attrs );
},

View File

@ -789,7 +789,7 @@ function wp_restore_group_inner_container( $block_content, $block ) {
);
$updated_content = preg_replace_callback(
$replace_regex,
static function( $matches ) {
static function ( $matches ) {
return $matches[1] . '<div class="wp-block-group__inner-container">' . $matches[2] . '</div>' . $matches[3];
},
$block_content

View File

@ -532,7 +532,7 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
*
* @return string Returns the block content.
*/
$settings['render_callback'] = static function( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
$settings['render_callback'] = static function ( $attributes, $content, $block ) use ( $template_path ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
ob_start();
require $template_path;
return ob_get_clean();

View File

@ -87,7 +87,7 @@ function register_core_block_style_handles() {
}
}
$register_style = static function( $name, $filename, $style_handle ) use ( $blocks_url, $suffix, $wp_styles, $files ) {
$register_style = static function ( $name, $filename, $style_handle ) use ( $blocks_url, $suffix, $wp_styles, $files ) {
$style_path = "{$name}/{$filename}{$suffix}.css";
$path = wp_normalize_path( BLOCKS_PATH . $style_path );

View File

@ -982,10 +982,10 @@ final class WP_Customize_Widgets {
$args['transport'] = current_theme_supports( 'customize-selective-refresh-widgets' ) ? 'postMessage' : 'refresh';
} elseif ( preg_match( $this->setting_id_patterns['widget_instance'], $id, $matches ) ) {
$id_base = $matches['id_base'];
$args['sanitize_callback'] = function( $value ) use ( $id_base ) {
$args['sanitize_callback'] = function ( $value ) use ( $id_base ) {
return $this->sanitize_widget_instance( $value, $id_base );
};
$args['sanitize_js_callback'] = function( $value ) use ( $id_base ) {
$args['sanitize_js_callback'] = function ( $value ) use ( $id_base ) {
return $this->sanitize_widget_js_instance( $value, $id_base );
};
$args['transport'] = $this->is_widget_selective_refreshable( $matches['id_base'] ) ? 'postMessage' : 'refresh';

View File

@ -463,7 +463,7 @@ class WP_Http {
if ( $value instanceof WP_Http_Cookie ) {
$attributes = array_filter(
$value->get_attributes(),
static function( $attr ) {
static function ( $attr ) {
return null !== $attr;
}
);

View File

@ -169,7 +169,7 @@ class WP_Navigation_Fallback {
private static function get_most_recently_created_nav_menu( $classic_nav_menus ) {
usort(
$classic_nav_menus,
static function( $a, $b ) {
static function ( $a, $b ) {
return $b->term_id - $a->term_id;
}
);

View File

@ -2334,7 +2334,7 @@ class WP_Theme_JSON {
// Prepend the variation selector to the current selector.
$split_selectors = explode( ',', $shortened_selector );
$updated_selectors = array_map(
static function( $split_selector ) use ( $clean_style_variation_selector ) {
static function ( $split_selector ) use ( $clean_style_variation_selector ) {
return $clean_style_variation_selector . $split_selector;
},
$split_selectors
@ -2372,7 +2372,7 @@ class WP_Theme_JSON {
$pseudo_matches = array_values(
array_filter(
$element_pseudo_allowed,
static function( $pseudo_selector ) use ( $selector ) {
static function ( $pseudo_selector ) use ( $selector ) {
return str_contains( $selector, $pseudo_selector );
}
)
@ -3733,7 +3733,7 @@ class WP_Theme_JSON {
$theme_vars = static::compute_theme_vars( $settings );
$vars = array_reduce(
array_merge( $preset_vars, $theme_vars ),
function( $carry, $item ) {
function ( $carry, $item ) {
$name = $item['name'];
$carry[ "var({$name})" ] = $item['value'];
return $carry;

View File

@ -3259,7 +3259,7 @@ function wp_rel_nofollow( $text ) {
$text = stripslashes( $text );
$text = preg_replace_callback(
'|<a (.+?)>|i',
static function( $matches ) {
static function ( $matches ) {
return wp_rel_callback( $matches, 'nofollow' );
},
$text
@ -3293,7 +3293,7 @@ function wp_rel_ugc( $text ) {
$text = stripslashes( $text );
$text = preg_replace_callback(
'|<a (.+?)>|i',
static function( $matches ) {
static function ( $matches ) {
return wp_rel_callback( $matches, 'nofollow ugc' );
},
$text
@ -4756,7 +4756,7 @@ EOF;
$safe_text = (string) preg_replace_callback(
$regex,
static function( $matches ) {
static function ( $matches ) {
if ( ! isset( $matches[0] ) ) {
return '';
}

View File

@ -846,7 +846,7 @@ function wp_extract_urls( $content ) {
$post_links = array_unique(
array_map(
static function( $link ) {
static function ( $link ) {
// Decode to replace valid entities, like &amp;.
$link = html_entity_decode( $link );
// Maintain backward compatibility by removing extraneous semi-colons (`;`).

View File

@ -1183,7 +1183,7 @@ function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) {
// Check if there are attributes that are required.
$required_attrs = array_filter(
$allowed_html[ $element_low ],
static function( $required_attr_limits ) {
static function ( $required_attr_limits ) {
return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required'];
}
);

View File

@ -6071,7 +6071,7 @@ function get_pages( $args = array() ) {
*/
$orderby = wp_parse_list( $parsed_args['sort_column'] );
$orderby = array_map(
static function( $orderby_field ) {
static function ( $orderby_field ) {
$orderby_field = trim( $orderby_field );
if ( 'post_modified_gmt' === $orderby_field || 'modified_gmt' === $orderby_field ) {
$orderby_field = str_replace( '_gmt', '', $orderby_field );

View File

@ -625,7 +625,7 @@ abstract class WP_REST_Controller {
// Return the list of all requested fields which appear in the schema.
return array_reduce(
$requested_fields,
static function( $response_fields, $field ) use ( $fields ) {
static function ( $response_fields, $field ) use ( $fields ) {
if ( in_array( $field, $fields, true ) ) {
$response_fields[] = $field;
return $response_fields;

View File

@ -381,7 +381,7 @@ class WP_REST_Plugins_Controller extends WP_REST_Controller {
$installed_locales = apply_filters( 'plugins_update_check_locales', $installed_locales );
$language_packs = array_map(
static function( $item ) {
static function ( $item ) {
return (object) $item;
},
$api->language_packs
@ -389,7 +389,7 @@ class WP_REST_Plugins_Controller extends WP_REST_Controller {
$language_packs = array_filter(
$language_packs,
static function( $pack ) use ( $installed_locales ) {
static function ( $pack ) use ( $installed_locales ) {
return in_array( $pack->language, $installed_locales, true );
}
);

View File

@ -152,7 +152,7 @@ class WP_REST_Site_Health_Controller extends WP_REST_Controller {
array(
'methods' => 'GET',
'callback' => array( $this, 'get_directory_sizes' ),
'permission_callback' => function() {
'permission_callback' => function () {
return $this->validate_request_permission( 'directory_sizes' ) && ! is_multisite();
},
)

View File

@ -85,7 +85,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
'form_data' => array(
'description' => __( 'Serialized widget form data to encode into instance settings.' ),
'type' => 'string',
'sanitize_callback' => static function( $form_data ) {
'sanitize_callback' => static function ( $form_data ) {
$array = array();
wp_parse_str( $form_data, $array );
return $array;

View File

@ -861,7 +861,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
'type' => 'string',
'context' => array(),
'arg_options' => array(
'sanitize_callback' => static function( $form_data ) {
'sanitize_callback' => static function ( $form_data ) {
$array = array();
wp_parse_str( $form_data, $array );
return $array;

View File

@ -2453,7 +2453,7 @@ function wp_common_block_scripts_and_styles() {
function wp_filter_out_block_nodes( $nodes ) {
return array_filter(
$nodes,
static function( $node ) {
static function ( $node ) {
return ! in_array( 'blocks', $node['path'], true );
},
ARRAY_FILTER_USE_BOTH
@ -2655,7 +2655,7 @@ function enqueue_block_styles_assets() {
if ( wp_should_load_separate_core_block_assets() ) {
add_filter(
'render_block',
static function( $html, $block ) use ( $block_name, $style_properties ) {
static function ( $html, $block ) use ( $block_name, $style_properties ) {
if ( $block['blockName'] === $block_name ) {
wp_enqueue_style( $style_properties['style_handle'] );
}
@ -2917,7 +2917,7 @@ function wp_maybe_inline_styles() {
// Reorder styles array based on size.
usort(
$styles,
static function( $a, $b ) {
static function ( $a, $b ) {
return ( $a['size'] <= $b['size'] ) ? -1 : 1;
}
);
@ -3150,7 +3150,7 @@ function wp_enqueue_block_style( $block_name, $args ) {
* is to ensure the content exists.
* @return string Block content.
*/
$callback = static function( $content ) use ( $args ) {
$callback = static function ( $content ) use ( $args ) {
// Register the stylesheet.
if ( ! empty( $args['src'] ) ) {
wp_register_style( $args['handle'], $args['src'], $args['deps'], $args['ver'], $args['media'] );
@ -3188,7 +3188,7 @@ function wp_enqueue_block_style( $block_name, $args ) {
* @param array $block The full block, including name and attributes.
* @return string Block content.
*/
$callback_separate = static function( $content, $block ) use ( $block_name, $callback ) {
$callback_separate = static function ( $content, $block ) use ( $block_name, $callback ) {
if ( ! empty( $block['blockName'] ) && $block_name === $block['blockName'] ) {
return $callback( $content );
}

View File

@ -553,7 +553,7 @@ function wp_update_plugins( $extra_stats = array() ) {
}
}
$sanitize_plugin_update_payload = static function( &$item ) {
$sanitize_plugin_update_payload = static function ( &$item ) {
$item = (object) $item;
unset( $item->translations, $item->compatibility );

View File

@ -3899,7 +3899,7 @@ function wp_user_personal_data_exporter( $email_address ) {
// Remove items that use reserved names.
$extra_data = array_filter(
$_extra_data,
static function( $item ) use ( $reserved_names ) {
static function ( $item ) use ( $reserved_names ) {
return ! in_array( $item['name'], $reserved_names, true );
}
);

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56558';
$wp_version = '6.4-alpha-56559';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.