Skip to content

Commit

Permalink
Coding Standards: Include one space after function keyword for clos…
Browse files Browse the repository at this point in the history
…ures.

Note: This is enforced by WPCS 3.0.0.

Reference: [WordPress/WordPress-Coding-Standards#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
  • Loading branch information
SergeyBiryukov committed Sep 12, 2023
1 parent 251a9c7 commit e549011
Show file tree
Hide file tree
Showing 32 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion wp-admin/edit-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// 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";
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/class-wp-community-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ protected function trim_events( array $events ) {

$future_wordcamps = array_filter(
$future_events,
static function( $wordcamp ) {
static function ( $wordcamp ) {
return 'wordcamp' === $wordcamp['type'];
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/class-wp-site-health-auto-updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function run_tests() {

$tests = array_filter( $tests );
$tests = array_map(
static function( $test ) {
static function ( $test ) {
$test = (object) $test;

if ( empty( $test->severity ) ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/options-privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

add_filter(
'admin_body_class',
static function( $body_class ) {
static function ( $body_class ) {
$body_class .= ' privacy-settings ';

return $body_class;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/privacy-policy-guide.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

add_filter(
'admin_body_class',
static function( $body_class ) {
static function ( $body_class ) {
$body_class .= ' privacy-settings ';

return $body_class;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
// 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";
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
// Remove the error parameter added by deprecation of wp-admin/media.php.
add_filter(
'removable_query_args',
function() {
function () {
return array( 'error' );
},
10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static function register( $wp_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() );
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function register( $wp_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';
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function customizer_controls( $wp_customize ) {
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' ) );
},
)
Expand All @@ -165,7 +165,7 @@ public function customizer_controls( $wp_customize ) {
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => static function( $value ) {
'sanitize_callback' => static function ( $value ) {
return (bool) $value;
},
)
Expand All @@ -188,7 +188,7 @@ public function customizer_controls( $wp_customize ) {
'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' ) );
},
)
Expand All @@ -200,7 +200,7 @@ public function customizer_controls( $wp_customize ) {
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 );
},
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static function ( $file ) {
}
}

$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 );

Expand Down
4 changes: 2 additions & 2 deletions wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,10 @@ public function get_setting_args( $id, $overrides = array() ) {
$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';
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-wp-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public static function normalize_cookies( $cookies ) {
if ( $value instanceof WP_Http_Cookie ) {
$attributes = array_filter(
$value->get_attributes(),
static function( $attr ) {
static function ( $attr ) {
return null !== $attr;
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/class-wp-navigation-fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private static function get_fallback_classic_menu() {
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;
}
);
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2334,7 +2334,7 @@ public function get_styles_for_block( $block_metadata ) {
// 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
Expand Down Expand Up @@ -2372,7 +2372,7 @@ static function( $split_selector ) use ( $clean_style_variation_selector ) {
$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 );
}
)
Expand Down Expand Up @@ -3733,7 +3733,7 @@ public static function resolve_variables( $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;
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -4756,7 +4756,7 @@ function esc_xml( $text ) {

$safe_text = (string) preg_replace_callback(
$regex,
static function( $matches ) {
static function ( $matches ) {
if ( ! isset( $matches[0] ) ) {
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 (`;`).
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ public function get_fields_for_response( $request ) {
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,15 @@ public function create_item( $request ) {
$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
);

$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 );
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function register_routes() {
array(
'methods' => 'GET',
'callback' => array( $this, 'get_directory_sizes' ),
'permission_callback' => function() {
'permission_callback' => function () {
return $this->validate_request_permission( 'directory_sizes' ) && ! is_multisite();
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function register_routes() {
'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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ public function get_item_schema() {
'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;
Expand Down
10 changes: 5 additions & 5 deletions wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'] );
}
Expand Down Expand Up @@ -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;
}
);
Expand Down Expand Up @@ -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'] );
Expand Down Expand Up @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e549011

Please sign in to comment.