Skip to content

Commit

Permalink
CS: one space after function keyword for closures
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Aug 21, 2023
1 parent b13ac58 commit 65289cf
Show file tree
Hide file tree
Showing 102 changed files with 208 additions and 208 deletions.
2 changes: 1 addition & 1 deletion src/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 src/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
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 src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -2725,7 +2725,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 src/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 src/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 src/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 src/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 src/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 src/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 src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,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 ) {
$settings['render_callback'] = static function ( $attributes, $content, $block ) use ( $template_path ) {
ob_start();
require $template_path;
return ob_get_clean();
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/comment-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function block_core_comment_template_render_comments( $comments, $block ) {
$content = '';
foreach ( $comments as $comment ) {
$comment_id = $comment->comment_ID;
$filter_block_context = static function( $context ) use ( $comment_id ) {
$filter_block_context = static function ( $context ) use ( $comment_id ) {
$context['commentId'] = $comment_id;
return $context;
};
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/comments-pagination-next.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );

$filter_link_attributes = static function() {
$filter_link_attributes = static function () {
return get_block_wrapper_attributes();
};
add_filter( 'next_comments_link_attributes', $filter_link_attributes );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/comments-pagination-previous.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
$label = $pagination_arrow . $label;
}

$filter_link_attributes = static function() {
$filter_link_attributes = static function () {
return get_block_wrapper_attributes();
};
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function register_core_block_style_handles() {
$files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
}

$register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) {
$register_style = static function ( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) {
$style_path = "blocks/{$name}/{$filename}{$suffix}.css";
$path = wp_normalize_path( $includes_path . $style_path );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/latest-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function render_block_core_latest_posts( $attributes ) {
$block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );

$filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) {
$filter_latest_posts_excerpt_more = static function ( $more ) use ( $attributes ) {
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function block_core_navigation_render_submenu_icon() {
function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) {
$filtered = array_filter(
$parsed_blocks,
static function( $block ) {
static function ( $block ) {
return isset( $block['blockName'] );
}
);
Expand Down Expand Up @@ -930,7 +930,7 @@ function block_core_navigation_get_classic_menu_fallback() {
// Otherwise return the most recently created classic menu.
usort(
$classic_nav_menus,
static function( $a, $b ) {
static function ( $a, $b ) {
return $b->term_id - $a->term_id;
}
);
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/blocks/post-excerpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
}

$more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . wp_kses_post( $attributes['moreText'] ) . '</a>' : '';
$filter_excerpt_more = static function( $more ) use ( $more_text ) {
$filter_excerpt_more = static function ( $more ) use ( $more_text ) {
return empty( $more_text ) ? $more : '';
};
/**
Expand Down Expand Up @@ -87,7 +87,7 @@ function register_block_core_post_excerpt() {
defined( 'REST_REQUEST' ) && REST_REQUEST ) {
add_filter(
'excerpt_length',
static function() {
static function () {
return 100;
},
PHP_INT_MAX
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function render_block_core_post_template( $attributes, $content, $block ) {

$post_id = get_the_ID();
$post_type = get_post_type();
$filter_block_context = static function( $context ) use ( $post_id, $post_type ) {
$filter_block_context = static function ( $context ) use ( $post_id, $post_type ) {
$context['postType'] = $post_type;
$context['postId'] = $post_id;
return $context;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query-pagination-next.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block

// Check if the pagination is for Query that inherits the global context.
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
$filter_link_attributes = static function() use ( $wrapper_attributes ) {
$filter_link_attributes = static function () use ( $wrapper_attributes ) {
return $wrapper_attributes;
};
add_filter( 'next_posts_link_attributes', $filter_link_attributes );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query-pagination-previous.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
// Check if the pagination is for Query that inherits the global context
// and handle appropriately.
if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
$filter_link_attributes = static function() use ( $wrapper_attributes ) {
$filter_link_attributes = static function () use ( $wrapper_attributes ) {
return $wrapper_attributes;
};

Expand Down
4 changes: 2 additions & 2 deletions src/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 src/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 src/wp-includes/class-wp-navigation-fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,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 src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,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 @@ -2364,7 +2364,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 @@ -3709,7 +3709,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 src/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 src/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 src/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
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( 'debug_enabled' ) && ! is_multisite();
},
)
Expand Down
Loading

0 comments on commit 65289cf

Please sign in to comment.