diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php index 66a6bbfc25326..e200b29621924 100644 --- a/src/wp-admin/edit-form-blocks.php +++ b/src/wp-admin/edit-form-blocks.php @@ -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"; } ); diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php index 09557c86a4782..008611af21c09 100644 --- a/src/wp-admin/includes/class-wp-community-events.php +++ b/src/wp-admin/includes/class-wp-community-events.php @@ -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']; } ); diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php index a5bf636fc80c9..85decaaad2b7b 100644 --- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -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 ) ) { diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 23e05cd92002b..f21b0815260c1 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -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 ) { diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 6085b02c8fdc4..fdb522c889609 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -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. * diff --git a/src/wp-admin/options-privacy.php b/src/wp-admin/options-privacy.php index 5c22d39d5df67..1afb8c0601388 100644 --- a/src/wp-admin/options-privacy.php +++ b/src/wp-admin/options-privacy.php @@ -23,7 +23,7 @@ add_filter( 'admin_body_class', - static function( $body_class ) { + static function ( $body_class ) { $body_class .= ' privacy-settings '; return $body_class; diff --git a/src/wp-admin/privacy-policy-guide.php b/src/wp-admin/privacy-policy-guide.php index 7e92a4dea6a83..b8f303aa7f4e0 100644 --- a/src/wp-admin/privacy-policy-guide.php +++ b/src/wp-admin/privacy-policy-guide.php @@ -22,7 +22,7 @@ add_filter( 'admin_body_class', - static function( $body_class ) { + static function ( $body_class ) { $body_class .= ' privacy-settings '; return $body_class; diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index b7cdfbe0dff63..2da7222d7c8ff 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -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"; } ); diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index 29a8c4de8d193..e0a7abd47be02 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -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, diff --git a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php index dedcb3788243b..8a560a8d49ab4 100644 --- a/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php +++ b/src/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php @@ -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() ); }, ) diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php index d3af05ec42a79..903334089db4d 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-customize.php @@ -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'; }, ) diff --git a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php index 01af9ea3ddc98..b32afa06ea7f1 100644 --- a/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php +++ b/src/wp-content/themes/twentytwentyone/classes/class-twenty-twenty-one-dark-mode.php @@ -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' ) ); }, ) @@ -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; }, ) @@ -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' ) ); }, ) @@ -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 ); }, diff --git a/src/wp-includes/block-supports/layout.php b/src/wp-includes/block-supports/layout.php index 519574238dee9..89713c772d206 100644 --- a/src/wp-includes/block-supports/layout.php +++ b/src/wp-includes/block-supports/layout.php @@ -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] . '
' . $matches[2] . '
' . $matches[3]; }, $block_content diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php index d0573297dd1ab..3153cda3ef3ad 100644 --- a/src/wp-includes/blocks.php +++ b/src/wp-includes/blocks.php @@ -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(); diff --git a/src/wp-includes/blocks/comment-template.php b/src/wp-includes/blocks/comment-template.php index 5a0eef5685cf1..915c5880a8f96 100644 --- a/src/wp-includes/blocks/comment-template.php +++ b/src/wp-includes/blocks/comment-template.php @@ -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; }; diff --git a/src/wp-includes/blocks/comments-pagination-next.php b/src/wp-includes/blocks/comments-pagination-next.php index 5a8df691ff092..51d1f75c58d47 100644 --- a/src/wp-includes/blocks/comments-pagination-next.php +++ b/src/wp-includes/blocks/comments-pagination-next.php @@ -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 ); diff --git a/src/wp-includes/blocks/comments-pagination-previous.php b/src/wp-includes/blocks/comments-pagination-previous.php index ed3fa653abda9..f194e8ab517f5 100644 --- a/src/wp-includes/blocks/comments-pagination-previous.php +++ b/src/wp-includes/blocks/comments-pagination-previous.php @@ -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 ); diff --git a/src/wp-includes/blocks/index.php b/src/wp-includes/blocks/index.php index 4a95b903516f2..68d54d23766d9 100644 --- a/src/wp-includes/blocks/index.php +++ b/src/wp-includes/blocks/index.php @@ -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 ); diff --git a/src/wp-includes/blocks/latest-posts.php b/src/wp-includes/blocks/latest-posts.php index c7a37fe0fe31f..e8e2dc8dd02fa 100644 --- a/src/wp-includes/blocks/latest-posts.php +++ b/src/wp-includes/blocks/latest-posts.php @@ -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( __( ' … Read more' ), esc_url( get_permalink() ) ) : $more; diff --git a/src/wp-includes/blocks/navigation.php b/src/wp-includes/blocks/navigation.php index 6de09f8dd36aa..ac800aaa78797 100644 --- a/src/wp-includes/blocks/navigation.php +++ b/src/wp-includes/blocks/navigation.php @@ -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'] ); } ); @@ -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; } ); diff --git a/src/wp-includes/blocks/post-excerpt.php b/src/wp-includes/blocks/post-excerpt.php index 4ed4edab95078..09d6b6f003d34 100644 --- a/src/wp-includes/blocks/post-excerpt.php +++ b/src/wp-includes/blocks/post-excerpt.php @@ -31,7 +31,7 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) { } $more_text = ! empty( $attributes['moreText'] ) ? '' . wp_kses_post( $attributes['moreText'] ) . '' : ''; - $filter_excerpt_more = static function( $more ) use ( $more_text ) { + $filter_excerpt_more = static function ( $more ) use ( $more_text ) { return empty( $more_text ) ? $more : ''; }; /** @@ -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 diff --git a/src/wp-includes/blocks/post-template.php b/src/wp-includes/blocks/post-template.php index 88b7c27f1c66f..55c0596ada6d0 100644 --- a/src/wp-includes/blocks/post-template.php +++ b/src/wp-includes/blocks/post-template.php @@ -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; diff --git a/src/wp-includes/blocks/query-pagination-next.php b/src/wp-includes/blocks/query-pagination-next.php index f0ded727ee8a9..f6e5b54e1a21a 100644 --- a/src/wp-includes/blocks/query-pagination-next.php +++ b/src/wp-includes/blocks/query-pagination-next.php @@ -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 ); diff --git a/src/wp-includes/blocks/query-pagination-previous.php b/src/wp-includes/blocks/query-pagination-previous.php index 5665506598f81..9095a0c614987 100644 --- a/src/wp-includes/blocks/query-pagination-previous.php +++ b/src/wp-includes/blocks/query-pagination-previous.php @@ -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; }; diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php index 41a57dc66bbe1..93006ef91671e 100644 --- a/src/wp-includes/class-wp-customize-widgets.php +++ b/src/wp-includes/class-wp-customize-widgets.php @@ -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'; diff --git a/src/wp-includes/class-wp-http.php b/src/wp-includes/class-wp-http.php index 423ad9968cee0..12bfa48dad8fd 100644 --- a/src/wp-includes/class-wp-http.php +++ b/src/wp-includes/class-wp-http.php @@ -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; } ); diff --git a/src/wp-includes/class-wp-navigation-fallback.php b/src/wp-includes/class-wp-navigation-fallback.php index 70ddf11e4efca..f05a2344afde4 100644 --- a/src/wp-includes/class-wp-navigation-fallback.php +++ b/src/wp-includes/class-wp-navigation-fallback.php @@ -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; } ); diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 8af40bbd80341..f8545443ab19e 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -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 @@ -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 ); } ) @@ -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; diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index 4309bd4521ccf..562bcd4607e00 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -3259,7 +3259,7 @@ function wp_rel_nofollow( $text ) { $text = stripslashes( $text ); $text = preg_replace_callback( '||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( '||i', - static function( $matches ) { + static function ( $matches ) { return wp_rel_callback( $matches, 'nofollow ugc' ); }, $text @@ -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 ''; } diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ecdeb45a421fa..344ba321e77bc 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -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 &. $link = html_entity_decode( $link ); // Maintain backward compatibility by removing extraneous semi-colons (`;`). diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 7eeadca569944..f6bd75741d6c4 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -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']; } ); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php index 81fc991ba980f..4b960d6c6b157 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php @@ -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; diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php index 4cbc5063e906e..8d24b60db26cb 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php @@ -381,7 +381,7 @@ 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 @@ -389,7 +389,7 @@ static function( $item ) { $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 ); } ); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php index 43e6676eff0ea..0c467a6163009 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php @@ -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(); }, ) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php index 9734ae66255c0..b01dd1649ec43 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php @@ -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; diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php index 267a75ffaedb9..acbd88c4896d1 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php @@ -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; diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 205cedda72580..a040998589b05 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2428,7 +2428,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 @@ -2630,7 +2630,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'] ); } @@ -2892,7 +2892,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; } ); @@ -3125,7 +3125,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'] ); @@ -3163,7 +3163,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 ); } @@ -3246,7 +3246,7 @@ function _wp_theme_json_webfonts_handler() { * * @return array Array of defined webfonts. */ - $fn_get_webfonts_from_theme_json = static function() { + $fn_get_webfonts_from_theme_json = static function () { // Get settings from theme.json. $settings = WP_Theme_JSON_Resolver::get_merged_data()->get_settings(); @@ -3317,7 +3317,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $src Webfont file(s) `src`. * @return array Webfont's `src` in URI. */ - $fn_transform_src_into_uri = static function( array $src ) { + $fn_transform_src_into_uri = static function ( array $src ) { foreach ( $src as $key => $url ) { // Tweak the URL to be relative to the theme root. if ( ! str_starts_with( $url, 'file:./' ) ) { @@ -3338,7 +3338,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $font_face Font face to convert. * @return array Font faces with each property in kebab-case format. */ - $fn_convert_keys_to_kebab_case = static function( array $font_face ) { + $fn_convert_keys_to_kebab_case = static function ( array $font_face ) { foreach ( $font_face as $property => $value ) { $kebab_case = _wp_to_kebab_case( $property ); $font_face[ $kebab_case ] = $value; @@ -3358,7 +3358,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $webfont The webfont arguments. * @return array|false The validated webfont arguments, or false if the webfont is invalid. */ - $fn_validate_webfont = static function( $webfont ) { + $fn_validate_webfont = static function ( $webfont ) { $webfont = wp_parse_args( $webfont, array( @@ -3441,7 +3441,7 @@ function _wp_theme_json_webfonts_handler() { * @uses $fn_convert_keys_to_kebab_case To run the function that converts keys into kebab-case. * @uses $fn_validate_webfont To run the function that validates each font-face (webfont) from theme.json. */ - $fn_register_webfonts = static function() use ( &$registered_webfonts, $fn_get_webfonts_from_theme_json, $fn_convert_keys_to_kebab_case, $fn_validate_webfont, $fn_transform_src_into_uri ) { + $fn_register_webfonts = static function () use ( &$registered_webfonts, $fn_get_webfonts_from_theme_json, $fn_convert_keys_to_kebab_case, $fn_validate_webfont, $fn_transform_src_into_uri ) { $registered_webfonts = array(); foreach ( $fn_get_webfonts_from_theme_json() as $webfont ) { @@ -3472,7 +3472,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $webfont Webfont to process. * @return array Ordered `src` items. */ - $fn_order_src = static function( array $webfont ) { + $fn_order_src = static function ( array $webfont ) { $src = array(); $src_ordered = array(); @@ -3543,7 +3543,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $value Value to process. * @return string The CSS. */ - $fn_compile_src = static function( $font_family, array $value ) { + $fn_compile_src = static function ( $font_family, array $value ) { $src = ''; foreach ( $value as $item ) { @@ -3565,7 +3565,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $font_variation_settings Array of font variation settings. * @return string The CSS. */ - $fn_compile_variations = static function( array $font_variation_settings ) { + $fn_compile_variations = static function ( array $font_variation_settings ) { $variations = ''; foreach ( $font_variation_settings as $key => $value ) { @@ -3586,7 +3586,7 @@ function _wp_theme_json_webfonts_handler() { * @param array $webfont Webfont to process. * @return string This font-family's CSS. */ - $fn_build_font_face_css = static function( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) { + $fn_build_font_face_css = static function ( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) { $css = ''; // Wrap font-family in quotes if it contains spaces. @@ -3636,7 +3636,7 @@ function _wp_theme_json_webfonts_handler() { * * @return string The `@font-face` CSS. */ - $fn_get_css = static function() use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) { + $fn_get_css = static function () use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) { $css = ''; foreach ( $registered_webfonts as $webfont ) { @@ -3657,7 +3657,7 @@ function _wp_theme_json_webfonts_handler() { * * @uses $fn_get_css To run the function that gets the CSS. */ - $fn_generate_and_enqueue_styles = static function() use ( $fn_get_css ) { + $fn_generate_and_enqueue_styles = static function () use ( $fn_get_css ) { // Generate the styles. $styles = $fn_get_css(); @@ -3681,7 +3681,7 @@ function _wp_theme_json_webfonts_handler() { * * @uses $fn_get_css To run the function that gets the CSS. */ - $fn_generate_and_enqueue_editor_styles = static function() use ( $fn_get_css ) { + $fn_generate_and_enqueue_editor_styles = static function () use ( $fn_get_css ) { // Generate the styles. $styles = $fn_get_css(); diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php index 7c4e31feefe99..19edfa4b3c184 100644 --- a/src/wp-includes/update.php +++ b/src/wp-includes/update.php @@ -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 ); diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 934d7fea49ac9..d51f0de26d02d 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -3888,7 +3888,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 ); } ); diff --git a/tests/performance/wp-content/mu-plugins/server-timing.php b/tests/performance/wp-content/mu-plugins/server-timing.php index 9ae95561ec903..4f9a0d04f1ebb 100644 --- a/tests/performance/wp-content/mu-plugins/server-timing.php +++ b/tests/performance/wp-content/mu-plugins/server-timing.php @@ -2,7 +2,7 @@ add_filter( 'template_include', - static function( $template ) { + static function ( $template ) { global $timestart; @@ -15,7 +15,7 @@ static function( $template ) { add_action( 'shutdown', - static function() use ( $server_timing_values, $template_start ) { + static function () use ( $server_timing_values, $template_start ) { global $timestart; diff --git a/tests/phpunit/tests/actions.php b/tests/phpunit/tests/actions.php index a3a5eee4de68e..667b13d9f7d80 100644 --- a/tests/phpunit/tests/actions.php +++ b/tests/phpunit/tests/actions.php @@ -387,7 +387,7 @@ public function test_action_keyed_array() { */ public function test_action_closure() { $hook_name = __FUNCTION__; - $closure = static function( $a, $b ) { + $closure = static function ( $a, $b ) { $GLOBALS[ $a ] = $b; }; add_action( $hook_name, $closure, 10, 2 ); @@ -399,7 +399,7 @@ public function test_action_closure() { $this->assertSame( $GLOBALS[ $context[0] ], $context[1] ); $hook_name2 = __FUNCTION__ . '_2'; - $closure2 = static function() { + $closure2 = static function () { $GLOBALS['closure_no_args'] = true; }; add_action( $hook_name2, $closure2 ); diff --git a/tests/phpunit/tests/admin/includesFile.php b/tests/phpunit/tests/admin/includesFile.php index 375f895c84a2e..4a5295b29a0be 100644 --- a/tests/phpunit/tests/admin/includesFile.php +++ b/tests/phpunit/tests/admin/includesFile.php @@ -343,7 +343,7 @@ public function test_download_url_no_warning_for_url_without_path_with_signature add_filter( 'wp_signature_hosts', - static function( $urls ) { + static function ( $urls ) { $urls[] = 'example.com'; return $urls; } diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index 4ce59dbabe177..102449cc79899 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -795,7 +795,7 @@ public function test_get_sample_permalink_should_preserve_the_original_post_prop add_filter( 'get_sample_permalink', - function( $permalink, $post_id, $title, $name, $post ) use ( $post_original ) { + function ( $permalink, $post_id, $title, $name, $post ) use ( $post_original ) { $this->assertEquals( $post_original, $post, 'Modified post object passed to get_sample_permalink filter.' ); return $permalink; }, diff --git a/tests/phpunit/tests/admin/includesSchema.php b/tests/phpunit/tests/admin/includesSchema.php index f33dff148b9dc..77b3e06a53ed6 100644 --- a/tests/phpunit/tests/admin/includesSchema.php +++ b/tests/phpunit/tests/admin/includesSchema.php @@ -192,7 +192,7 @@ public function test_populate_options_when_locale_uses_deprecated_timezone_strin // Set the "default" value for the timezone to a deprecated timezone. add_filter( 'gettext_with_context', - static function( $translation, $text, $context ) { + static function ( $translation, $text, $context ) { if ( '0' === $text && 'default GMT offset or timezone string' === $context ) { return 'America/Buenos_Aires'; } diff --git a/tests/phpunit/tests/admin/wpAutomaticUpdater.php b/tests/phpunit/tests/admin/wpAutomaticUpdater.php index eb91a97c09e5b..1746d9490c9db 100644 --- a/tests/phpunit/tests/admin/wpAutomaticUpdater.php +++ b/tests/phpunit/tests/admin/wpAutomaticUpdater.php @@ -54,7 +54,7 @@ public function set_up() { public function test_send_plugin_theme_email_should_append_plugin_urls( $urls, $successful, $failed ) { add_filter( 'wp_mail', - function( $args ) use ( $urls ) { + function ( $args ) use ( $urls ) { foreach ( $urls as $url ) { $this->assertStringContainsString( $url, @@ -322,7 +322,7 @@ public function data_send_plugin_theme_email_should_append_plugin_urls() { public function test_send_plugin_theme_email_should_not_append_plugin_urls( $urls, $successful, $failed ) { add_filter( 'wp_mail', - function( $args ) use ( $urls ) { + function ( $args ) use ( $urls ) { foreach ( $urls as $url ) { $this->assertStringNotContainsString( $url, diff --git a/tests/phpunit/tests/admin/wpCommentsListTable.php b/tests/phpunit/tests/admin/wpCommentsListTable.php index dc440a117bdbd..8ba12eed0e24d 100644 --- a/tests/phpunit/tests/admin/wpCommentsListTable.php +++ b/tests/phpunit/tests/admin/wpCommentsListTable.php @@ -96,7 +96,7 @@ public function test_empty_trash_button_should_not_be_shown_if_there_are_no_comm public function test_bulk_action_menu_supports_options_and_optgroups() { add_filter( 'bulk_actions-edit-comments', - static function() { + static function () { return array( 'delete' => 'Delete', 'Change State' => array( diff --git a/tests/phpunit/tests/admin/wpSiteHealth.php b/tests/phpunit/tests/admin/wpSiteHealth.php index 0d7ccb6112cbd..f8b2e2e0c8655 100644 --- a/tests/phpunit/tests/admin/wpSiteHealth.php +++ b/tests/phpunit/tests/admin/wpSiteHealth.php @@ -421,7 +421,7 @@ public function test_object_cache_default_thresholds_non_multisite() { // Set thresholds so high they should never be exceeded. add_filter( 'site_status_persistent_object_cache_thresholds', - static function() { + static function () { return array( 'alloptions_count' => PHP_INT_MAX, 'alloptions_bytes' => PHP_INT_MAX, diff --git a/tests/phpunit/tests/ajax/wpAjaxAddTag.php b/tests/phpunit/tests/ajax/wpAjaxAddTag.php index 6060b1db64256..fbb65ff6aec84 100755 --- a/tests/phpunit/tests/ajax/wpAjaxAddTag.php +++ b/tests/phpunit/tests/ajax/wpAjaxAddTag.php @@ -74,7 +74,7 @@ public function data_add_tag() { 'tag-name' => 'techno', ), 'expected' => 'A new category added.', - 'callback' => static function( array $messages ) { + 'callback' => static function ( array $messages ) { $messages['category'][1] = 'A new category added.'; return $messages; }, diff --git a/tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php b/tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php index fa41463c62a61..dbcc4cbe0f62b 100644 --- a/tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php +++ b/tests/phpunit/tests/ajax/wpAjaxAjaxTagSearch.php @@ -176,7 +176,7 @@ public function test_ajax_term_search_results_filter() { // Add the ajax_term_search_results filter. add_filter( 'ajax_term_search_results', - static function( $results, $tax, $s ) { + static function ( $results, $tax, $s ) { return array( 'ajax_term_search_results was applied' ); }, 10, diff --git a/tests/phpunit/tests/blocks/context.php b/tests/phpunit/tests/blocks/context.php index 68ead5d398f2f..3edddcf8ef6e5 100644 --- a/tests/phpunit/tests/blocks/context.php +++ b/tests/phpunit/tests/blocks/context.php @@ -109,7 +109,7 @@ public function test_provides_block_context() { 'gutenberg/contextWithAssigned', 'gutenberg/contextWithoutDefault', ), - 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) { + 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) { $provided_context[] = $block->context; return ''; @@ -149,7 +149,7 @@ public function test_provides_default_context() { 'gutenberg/test-context-consumer', array( 'uses_context' => array( 'postId', 'postType' ), - 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) { + 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) { $provided_context[] = $block->context; return ''; @@ -182,7 +182,7 @@ public function test_default_context_is_filterable() { 'gutenberg/test-context-consumer', array( 'uses_context' => array( 'example' ), - 'render_callback' => static function( $attributes, $content, $block ) use ( &$provided_context ) { + 'render_callback' => static function ( $attributes, $content, $block ) use ( &$provided_context ) { $provided_context[] = $block->context; return ''; @@ -190,7 +190,7 @@ public function test_default_context_is_filterable() { ) ); - $filter_block_context = static function( $context ) { + $filter_block_context = static function ( $context ) { $context['example'] = 'ok'; return $context; }; diff --git a/tests/phpunit/tests/blocks/editor.php b/tests/phpunit/tests/blocks/editor.php index 1d008560e90b5..13dbf59556547 100644 --- a/tests/phpunit/tests/blocks/editor.php +++ b/tests/phpunit/tests/blocks/editor.php @@ -307,7 +307,7 @@ public function test_get_default_block_editor_settings_max_upload_file_size() { // Force the return value of wp_max_upload_size() to be 500. add_filter( 'upload_size_limit', - static function() { + static function () { return 500; } ); diff --git a/tests/phpunit/tests/blocks/getBlockTemplates.php b/tests/phpunit/tests/blocks/getBlockTemplates.php index 50554479d0591..91f202a0b0119 100644 --- a/tests/phpunit/tests/blocks/getBlockTemplates.php +++ b/tests/phpunit/tests/blocks/getBlockTemplates.php @@ -101,7 +101,7 @@ public function set_up() { */ private function get_template_ids( $templates ) { return array_map( - static function( $template ) { + static function ( $template ) { return $template->id; }, $templates diff --git a/tests/phpunit/tests/blocks/register.php b/tests/phpunit/tests/blocks/register.php index f3617f5fad841..51cc22a2d2bee 100644 --- a/tests/phpunit/tests/blocks/register.php +++ b/tests/phpunit/tests/blocks/register.php @@ -927,7 +927,7 @@ public function test_has_blocks_with_invalid_post() { * @ticket 49615 */ public function test_filter_block_registration() { - $filter_registration = static function( $args, $name ) { + $filter_registration = static function ( $args, $name ) { $args['attributes'] = array( $name => array( 'type' => 'boolean' ) ); return $args; }; @@ -945,7 +945,7 @@ public function test_filter_block_registration() { * @ticket 52138 */ public function test_filter_block_registration_metadata() { - $filter_metadata_registration = static function( $metadata ) { + $filter_metadata_registration = static function ( $metadata ) { $metadata['apiVersion'] = 3; return $metadata; }; @@ -963,7 +963,7 @@ public function test_filter_block_registration_metadata() { * @ticket 52138 */ public function test_filter_block_registration_metadata_settings() { - $filter_metadata_registration = static function( $settings, $metadata ) { + $filter_metadata_registration = static function ( $settings, $metadata ) { $settings['api_version'] = $metadata['apiVersion'] + 1; return $settings; }; diff --git a/tests/phpunit/tests/blocks/renderCommentTemplate.php b/tests/phpunit/tests/blocks/renderCommentTemplate.php index 796bbcef8692f..0e29dc2241eec 100644 --- a/tests/phpunit/tests/blocks/renderCommentTemplate.php +++ b/tests/phpunit/tests/blocks/renderCommentTemplate.php @@ -536,7 +536,7 @@ public function test_rendering_comment_template_sets_comment_id_context() { add_filter( 'render_block', - static function( $block_content, $block ) use ( $parsed_comment_author_name_block ) { + static function ( $block_content, $block ) use ( $parsed_comment_author_name_block ) { /* * Insert a Comment Author Name block (which requires `commentId` * block context to work) after the Comment Content block. @@ -591,7 +591,7 @@ public function test_inner_block_inserted_by_render_block_data_is_retained() { $render_block_callback = new MockAction(); add_filter( 'render_block', array( $render_block_callback, 'filter' ), 10, 3 ); - $render_block_data_callback = static function( $parsed_block ) { + $render_block_data_callback = static function ( $parsed_block ) { // Add a Social Links block to a Comment Template block's inner blocks. if ( 'core/comment-template' === $parsed_block['blockName'] ) { $inserted_block_markup = <<registry->register( 'core/dynamic', array( - 'render_callback' => static function() { + 'render_callback' => static function () { return 'b'; }, ) @@ -296,7 +296,7 @@ public function test_render_passes_block_for_render_callback() { $this->registry->register( 'core/greeting', array( - 'render_callback' => static function( $attributes, $content, $block ) { + 'render_callback' => static function ( $attributes, $content, $block ) { return sprintf( 'Hello from %s', $block->name ); }, ) @@ -366,7 +366,7 @@ public function test_passes_attributes_to_render_callback() { 'default' => '!', ), ), - 'render_callback' => static function( $block_attributes ) { + 'render_callback' => static function ( $block_attributes ) { return sprintf( 'Hello %s%s', $block_attributes['toWhom'], @@ -391,7 +391,7 @@ public function test_passes_content_to_render_callback() { $this->registry->register( 'core/outer', array( - 'render_callback' => static function( $block_attributes, $content ) { + 'render_callback' => static function ( $block_attributes, $content ) { return $content; }, ) @@ -399,7 +399,7 @@ public function test_passes_content_to_render_callback() { $this->registry->register( 'core/inner', array( - 'render_callback' => static function() { + 'render_callback' => static function () { return 'b'; }, ) @@ -601,7 +601,7 @@ public function test_query_loop_block_query_vars_filter() { add_filter( 'query_loop_block_query_vars', - static function( $query, $block, $page ) { + static function ( $query, $block, $page ) { $query['post_type'] = 'book'; return $query; }, @@ -768,7 +768,7 @@ public function test_block_filters_for_inner_blocks() { $this->registry->register( 'core/outer', array( - 'render_callback' => static function( $block_attributes, $content ) { + 'render_callback' => static function ( $block_attributes, $content ) { return $content; }, ) @@ -777,7 +777,7 @@ public function test_block_filters_for_inner_blocks() { $this->registry->register( 'core/inner', array( - 'render_callback' => static function() { + 'render_callback' => static function () { return 'b'; }, ) diff --git a/tests/phpunit/tests/canonical.php b/tests/phpunit/tests/canonical.php index 6d16402112c21..10edea42bf517 100644 --- a/tests/phpunit/tests/canonical.php +++ b/tests/phpunit/tests/canonical.php @@ -247,7 +247,7 @@ public function test_pre_redirect_guess_404_permalink() { // Test short-circuit filter. add_filter( 'pre_redirect_guess_404_permalink', - static function() { + static function () { return 'wp'; } ); diff --git a/tests/phpunit/tests/category/walkerCategory.php b/tests/phpunit/tests/category/walkerCategory.php index 2728b11131168..9e1ff4e094525 100644 --- a/tests/phpunit/tests/category/walkerCategory.php +++ b/tests/phpunit/tests/category/walkerCategory.php @@ -40,7 +40,7 @@ public function test_start_el_with_empty_attributes( $value, $expected ) { add_filter( 'category_list_link_attributes', - static function( $atts ) use ( $value ) { + static function ( $atts ) use ( $value ) { $atts['data-test'] = $value; return $atts; } diff --git a/tests/phpunit/tests/cron.php b/tests/phpunit/tests/cron.php index 6369a244c624e..ec97b366d0713 100644 --- a/tests/phpunit/tests/cron.php +++ b/tests/phpunit/tests/cron.php @@ -910,7 +910,7 @@ public function test_disallowed_event_returns_error_when_wp_error_is_set_to_true * @covers ::wp_reschedule_event */ public function test_schedule_short_circuit_with_error_returns_false_when_wp_error_is_set_to_false() { - $return_error = function( $pre, $event, $wp_error ) { + $return_error = function ( $pre, $event, $wp_error ) { $this->assertFalse( $wp_error ); return new WP_Error( @@ -942,7 +942,7 @@ public function test_schedule_short_circuit_with_error_returns_false_when_wp_err * @covers ::wp_reschedule_event */ public function test_schedule_short_circuit_with_error_returns_error_when_wp_error_is_set_to_true() { - $return_error = function( $pre, $event, $wp_error ) { + $return_error = function ( $pre, $event, $wp_error ) { $this->assertTrue( $wp_error ); return new WP_Error( @@ -1029,7 +1029,7 @@ public function test_schedule_short_circuit_with_false_returns_error_when_wp_err * @covers ::wp_clear_scheduled_hook */ public function test_deprecated_argument_usage_of_wp_clear_scheduled_hook() { - $return_pre = function( $pre, $hook, $args, $wp_error ) { + $return_pre = function ( $pre, $hook, $args, $wp_error ) { $this->assertSame( array( 1, 2, 3 ), $args ); $this->assertFalse( $wp_error ); @@ -1072,7 +1072,7 @@ public function test_clear_scheduled_hook_returns_default_pre_filter_error_when_ * @covers ::wp_clear_scheduled_hook */ public function test_clear_scheduled_hook_returns_custom_pre_filter_error_when_wp_error_is_set_to_true() { - $return_error = function( $pre, $timestamp, $hook, $args, $wp_error ) { + $return_error = function ( $pre, $timestamp, $hook, $args, $wp_error ) { $this->assertTrue( $wp_error ); return new WP_Error( 'error_code', 'error message' ); @@ -1107,7 +1107,7 @@ public function test_clear_scheduled_hook_returns_custom_pre_filter_error_when_w * @covers ::wp_unschedule_hook */ public function test_unschedule_short_circuit_with_error_returns_false_when_wp_error_is_set_to_false() { - $return_error = function( $pre, $hook, $wp_error ) { + $return_error = function ( $pre, $hook, $wp_error ) { $this->assertFalse( $wp_error ); return new WP_Error( @@ -1132,7 +1132,7 @@ public function test_unschedule_short_circuit_with_error_returns_false_when_wp_e * @covers ::wp_unschedule_hook */ public function test_unschedule_short_circuit_with_error_returns_error_when_wp_error_is_set_to_true() { - $return_error = function( $pre, $hook, $wp_error ) { + $return_error = function ( $pre, $hook, $wp_error ) { $this->assertTrue( $wp_error ); return new WP_Error( @@ -1194,7 +1194,7 @@ public function test_cron_array_error_is_returned_when_scheduling_single_event() // Force update_option() to fail by setting the new value to match the existing: add_filter( 'pre_update_option_cron', - static function() { + static function () { return get_option( 'cron' ); } ); @@ -1216,7 +1216,7 @@ public function test_cron_array_error_is_returned_when_scheduling_event() { // Force update_option() to fail by setting the new value to match the existing: add_filter( 'pre_update_option_cron', - static function() { + static function () { return get_option( 'cron' ); } ); @@ -1241,7 +1241,7 @@ public function test_cron_array_error_is_returned_when_unscheduling_hook() { // Force update_option() to fail by setting the new value to match the existing: add_filter( 'pre_update_option_cron', - static function() { + static function () { return get_option( 'cron' ); } ); @@ -1267,7 +1267,7 @@ public function test_cron_array_error_is_returned_when_unscheduling_event() { // Force update_option() to fail by setting the new value to match the existing: add_filter( 'pre_update_option_cron', - static function() { + static function () { return get_option( 'cron' ); } ); diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index ca88433713113..37e751b294651 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -2917,7 +2917,7 @@ public function test_wp_external_wp_i18n_print_order() { wp_set_script_translations( 'common' ); $print_scripts = get_echo( - static function() { + static function () { wp_print_scripts(); _print_scripts(); } diff --git a/tests/phpunit/tests/feed/rss2.php b/tests/phpunit/tests/feed/rss2.php index 6fd0ba8c15eda..9a45230d3958c 100644 --- a/tests/phpunit/tests/feed/rss2.php +++ b/tests/phpunit/tests/feed/rss2.php @@ -533,7 +533,7 @@ public function test_feed_last_modified_should_be_a_post_date_when_withcomments_ // The Last-Modified header should have the post's date when "withcomments" is not passed. add_filter( 'wp_headers', - function( $headers ) use ( $last_week ) { + function ( $headers ) use ( $last_week ) { $this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $last_week ), @@ -572,7 +572,7 @@ public function test_feed_last_modified_should_be_the_date_of_a_comment_that_is_ // The Last-Modified header should have the comment's date when "withcomments=1" is passed. add_filter( 'wp_headers', - function( $headers ) use ( $yesterday ) { + function ( $headers ) use ( $yesterday ) { $this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $yesterday ), @@ -615,7 +615,7 @@ public function test_feed_last_modified_should_be_the_date_of_a_post_that_is_the // The Last-Modified header should have the date from today's post when it is the latest update. add_filter( 'wp_headers', - function( $headers ) use ( $today ) { + function ( $headers ) use ( $today ) { $this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $today ), diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php index 5102faab51f16..c99f1baffdd55 100644 --- a/tests/phpunit/tests/file.php +++ b/tests/phpunit/tests/file.php @@ -251,7 +251,7 @@ public function test_wp_tempnam_should_limit_filename_length_to_252_characters_w // Create a conflict by removing the randomness of the generated password. add_filter( 'random_password', - static function() { + static function () { return '123456'; }, 10, @@ -285,7 +285,7 @@ public function test_wp_tempnam_should_limit_filename_length_to_252_characters_w // Force random passwords to 12 characters. add_filter( 'random_password', - static function() { + static function () { return '1a2b3c4d5e6f'; }, 10, @@ -321,7 +321,7 @@ public function test_wp_tempnam_should_limit_filename_length_to_252_characters_w // Make the filter send the filename over the limit. add_filter( 'wp_unique_filename', - static function( $filename ) use ( &$filenames_over_limit ) { + static function ( $filename ) use ( &$filenames_over_limit ) { if ( strlen( $filename ) === 252 ) { $filename .= '1'; ++$filenames_over_limit; @@ -357,7 +357,7 @@ public function test_wp_tempnam_should_limit_filename_length_to_252_characters_w // Force random passwords to 12 characters. add_filter( 'random_password', - static function() { + static function () { return '1a2b3c4d5e6f'; }, 10, @@ -375,7 +375,7 @@ static function() { // Make the filter send the filename over the limit. add_filter( 'wp_unique_filename', - static function( $filename ) use ( &$filenames_over_limit ) { + static function ( $filename ) use ( &$filenames_over_limit ) { if ( strlen( $filename ) === 252 ) { $filename .= '1'; ++$filenames_over_limit; diff --git a/tests/phpunit/tests/formatting/wpTrimExcerpt.php b/tests/phpunit/tests/formatting/wpTrimExcerpt.php index 1cb4389ee9a35..ba5e99f7d8074 100644 --- a/tests/phpunit/tests/formatting/wpTrimExcerpt.php +++ b/tests/phpunit/tests/formatting/wpTrimExcerpt.php @@ -108,7 +108,7 @@ public function test_wp_trim_excerpt_unhooks_wp_filter_content_tags() { $has_filter = true; add_filter( 'the_content', - static function( $content ) use ( &$has_filter ) { + static function ( $content ) use ( &$has_filter ) { $has_filter = has_filter( 'the_content', 'wp_filter_content_tags' ); return $content; } diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index c87e6b88c76ab..c0dbd843c00ee 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -1716,7 +1716,7 @@ public function test_wp_check_filetype_and_ext_with_filtered_svg() { add_filter( 'upload_mimes', - static function( $mimes ) { + static function ( $mimes ) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } @@ -1754,7 +1754,7 @@ public function test_wp_check_filetype_and_ext_with_filtered_woff() { add_filter( 'upload_mimes', - static function( $mimes ) use ( $woff_mime_type ) { + static function ( $mimes ) use ( $woff_mime_type ) { $mimes['woff'] = $woff_mime_type; return $mimes; } diff --git a/tests/phpunit/tests/functions/wpFilesize.php b/tests/phpunit/tests/functions/wpFilesize.php index f0e510ddc5943..250f7e79c7724 100644 --- a/tests/phpunit/tests/functions/wpFilesize.php +++ b/tests/phpunit/tests/functions/wpFilesize.php @@ -25,7 +25,7 @@ public function test_wp_filesize_filters() { add_filter( 'wp_filesize', - static function() { + static function () { return 999; } ); @@ -34,7 +34,7 @@ static function() { add_filter( 'pre_wp_filesize', - static function() { + static function () { return 111; } ); diff --git a/tests/phpunit/tests/general/feedLinksExtra.php b/tests/phpunit/tests/general/feedLinksExtra.php index ee7f93640f1fe..3bea946e1aff1 100644 --- a/tests/phpunit/tests/general/feedLinksExtra.php +++ b/tests/phpunit/tests/general/feedLinksExtra.php @@ -491,14 +491,14 @@ public function test_feed_links_extra_should_return_empty_when_comments_and_ping public function test_feed_links_extra_should_respect_feed_type() { add_filter( 'default_feed', - static function() { + static function () { return 'foo'; } ); add_filter( 'feed_content_type', - static function() { + static function () { return 'testing/foo'; } ); diff --git a/tests/phpunit/tests/http/http.php b/tests/phpunit/tests/http/http.php index 876a5ed60b895..1648cca4eaf9f 100644 --- a/tests/phpunit/tests/http/http.php +++ b/tests/phpunit/tests/http/http.php @@ -593,7 +593,7 @@ public function test_multiple_location_headers() { // Filter the response made by WP_Http::handle_redirects(). add_filter( 'pre_http_request', - function( $response, $parsed_args, $url ) use ( &$pre_http_request_filter_has_run ) { + function ( $response, $parsed_args, $url ) use ( &$pre_http_request_filter_has_run ) { $pre_http_request_filter_has_run = true; // Assert the redirect URL is correct. diff --git a/tests/phpunit/tests/https-detection.php b/tests/phpunit/tests/https-detection.php index 820f39fc6e47a..80f16846994a9 100644 --- a/tests/phpunit/tests/https-detection.php +++ b/tests/phpunit/tests/https-detection.php @@ -117,7 +117,7 @@ public function test_pre_wp_update_https_detection_errors() { // Override to enforce no errors being detected. add_filter( 'pre_wp_update_https_detection_errors', - static function() { + static function () { return new WP_Error(); } ); @@ -127,7 +127,7 @@ static function() { // Override to enforce an error being detected. add_filter( 'pre_wp_update_https_detection_errors', - static function() { + static function () { return new WP_Error( 'ssl_verification_failed', 'Bad SSL certificate.' @@ -316,7 +316,7 @@ private function get_sample_html_string( $head_tag = '' ) { * @return callable Filter callback. */ private function filter_set_url_scheme( $scheme ) { - return static function( $url ) use ( $scheme ) { + return static function ( $url ) use ( $scheme ) { return set_url_scheme( $url, $scheme ); }; } diff --git a/tests/phpunit/tests/https-migration.php b/tests/phpunit/tests/https-migration.php index d06e1f0fba053..ae66738603e13 100644 --- a/tests/phpunit/tests/https-migration.php +++ b/tests/phpunit/tests/https-migration.php @@ -161,7 +161,7 @@ public function test_wp_should_replace_insecure_home_url_integration() { private function force_wp_is_using_https( $enabled ) { $scheme = $enabled ? 'https' : 'http'; - $replace_scheme = static function( $url ) use ( $scheme ) { + $replace_scheme = static function ( $url ) use ( $scheme ) { return str_replace( array( 'http://', 'https://' ), $scheme . '://', $url ); }; @@ -172,7 +172,7 @@ private function force_wp_is_using_https( $enabled ) { private function force_option( $option, $value ) { add_filter( "option_$option", - static function() use ( $value ) { + static function () use ( $value ) { return $value; } ); diff --git a/tests/phpunit/tests/image/editorImagick.php b/tests/phpunit/tests/image/editorImagick.php index 1209203904033..30747f69f1b62 100644 --- a/tests/phpunit/tests/image/editorImagick.php +++ b/tests/phpunit/tests/image/editorImagick.php @@ -683,7 +683,7 @@ public function test_remove_pdf_alpha_channel_should_remove_the_alpha_channel_in $check_file = path_join( dirname( $attached_file ), $check['file'] ); $imagick = new Imagick( $check_file ); $output = array_map( - static function( $value ) { + static function ( $value ) { return (int) round( $value ); }, array_intersect_key( $imagick->getImagePixelColor( 100, 100 )->getColor( true /* normalized */ ), $rgb ) diff --git a/tests/phpunit/tests/image/functions.php b/tests/phpunit/tests/image/functions.php index 356b2dceacd8c..f55b164496a84 100644 --- a/tests/phpunit/tests/image/functions.php +++ b/tests/phpunit/tests/image/functions.php @@ -692,7 +692,7 @@ public function test_wp_crop_image_should_fail_with_wp_error_object_if_there_was add_filter( 'wp_image_editors', - static function( $editors ) { + static function ( $editors ) { return array( 'WP_Image_Editor_Mock' ); } ); @@ -718,7 +718,7 @@ static function( $editors ) { public function test_wp_crop_image_should_return_correct_file_extension_if_output_format_was_modified() { add_filter( 'image_editor_output_format', - static function() { + static function () { return array_fill_keys( array( 'image/jpg', 'image/jpeg', 'image/png' ), 'image/webp' ); } ); diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php index 830359427a8fd..e297bf8427219 100644 --- a/tests/phpunit/tests/image/intermediateSize.php +++ b/tests/phpunit/tests/image/intermediateSize.php @@ -69,7 +69,7 @@ public function test_make_intermediate_size_successful() { public function test_image_editor_output_format_filter() { add_filter( 'image_editor_output_format', - static function() { + static function () { return array( 'image/jpeg' => 'image/webp' ); } ); diff --git a/tests/phpunit/tests/l10n/determineLocale.php b/tests/phpunit/tests/l10n/determineLocale.php index a2c3febd4a0ab..51ab1c28b95f6 100644 --- a/tests/phpunit/tests/l10n/determineLocale.php +++ b/tests/phpunit/tests/l10n/determineLocale.php @@ -33,7 +33,7 @@ public function test_short_circuit_empty() { public function test_short_circuit_no_string() { add_filter( 'pre_determine_locale', - static function() { + static function () { return 1234; } ); @@ -43,7 +43,7 @@ static function() { public function test_short_circuit_string() { add_filter( 'pre_determine_locale', - static function() { + static function () { return 'myNewLocale'; } ); @@ -53,7 +53,7 @@ static function() { public function test_defaults_to_site_locale() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -64,7 +64,7 @@ static function() { public function test_is_admin_no_user() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -77,7 +77,7 @@ static function() { public function test_is_admin_user_locale() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -91,7 +91,7 @@ static function() { public function test_json_request_user_locale() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -107,7 +107,7 @@ static function() { public function test_json_request_user_locale_no_user() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -121,7 +121,7 @@ static function() { public function test_json_request_missing_get_param() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -136,7 +136,7 @@ static function() { public function test_json_request_incorrect_get_param() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -152,7 +152,7 @@ static function() { public function test_get_param_but_no_json_request() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -167,7 +167,7 @@ static function() { public function test_wp_login_get_param_not_on_login_page() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -182,7 +182,7 @@ static function() { public function test_wp_login_get_param_on_login_page() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -198,7 +198,7 @@ static function() { public function test_wp_login_get_param_on_login_page_empty_string() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -214,7 +214,7 @@ static function() { public function test_wp_login_get_param_on_login_page_incorrect_string() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -230,7 +230,7 @@ static function() { public function test_wp_login_cookie_not_on_login_page() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -245,7 +245,7 @@ static function() { public function test_wp_login_cookie_on_login_page() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); @@ -261,7 +261,7 @@ static function() { public function test_wp_login_cookie_on_login_page_empty_string() { add_filter( 'locale', - static function() { + static function () { return 'siteLocale'; } ); diff --git a/tests/phpunit/tests/link/editTermLink.php b/tests/phpunit/tests/link/editTermLink.php index 3128ddfe0eb09..2e0145e5967c2 100644 --- a/tests/phpunit/tests/link/editTermLink.php +++ b/tests/phpunit/tests/link/editTermLink.php @@ -101,7 +101,7 @@ public function test_edit_term_link_filter_should_receive_term_id( $taxonomy, $u add_filter( 'edit_term_link', - function( $location, $term ) { + function ( $location, $term ) { $this->assertIsInt( $term ); }, 10, diff --git a/tests/phpunit/tests/link/getEditTermLink.php b/tests/phpunit/tests/link/getEditTermLink.php index 2df1aa7aac111..d0303f1b1a403 100644 --- a/tests/phpunit/tests/link/getEditTermLink.php +++ b/tests/phpunit/tests/link/getEditTermLink.php @@ -187,7 +187,7 @@ public function test_get_edit_term_link_filter_should_receive_term_id( $taxonomy add_filter( 'get_edit_term_link', - function( $location, $term ) { + function ( $location, $term ) { $this->assertIsInt( $term ); }, 10, diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 545d1c854f3a4..ebd2f767e1d3d 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -2357,7 +2357,7 @@ public function test_wp_filter_content_tags_filter_with_identical_image_tags_cus add_filter( 'wp_content_img_tag', - static function( $filtered_image ) { + static function ( $filtered_image ) { return "$filtered_image"; } ); @@ -2381,7 +2381,7 @@ public function test_wp_filter_content_tags_filter_with_identical_image_tags_dis add_filter( 'wp_content_img_tag', - static function( $filtered_image ) { + static function ( $filtered_image ) { return "$filtered_image"; } ); @@ -4020,7 +4020,7 @@ public function test_wp_filter_content_tags_does_not_lazy_load_first_featured_im add_filter( 'wp_img_tag_add_decoding_attr', '__return_false' ); add_filter( 'wp_get_attachment_image_attributes', - static function( $attr ) { + static function ( $attr ) { unset( $attr['srcset'], $attr['sizes'], $attr['decoding'] ); return $attr; } @@ -4154,7 +4154,7 @@ public function test_wp_filter_content_tags_does_not_apply_loading_optimization_ // Overwrite post content with an image. add_filter( 'the_content', - static function() use ( &$image_within_content ) { + static function () use ( &$image_within_content ) { // Replace content with an image tag, i.e. the 'wp_get_attachment_image' context is used while running 'the_content' filter. $image_within_content = wp_get_attachment_image( self::$large_id, 'large', false ); return $image_within_content; @@ -4221,7 +4221,7 @@ public function test_wp_get_loading_attr_default_should_return_false_for_special $result = null; add_filter( 'the_content', - static function( $content ) use ( &$result, $context ) { + static function ( $content ) use ( &$result, $context ) { $result = wp_get_loading_attr_default( $context ); return $content; } @@ -4523,7 +4523,7 @@ public function test_wp_get_loading_optimization_attributes_should_not_modify_im $result = null; add_filter( 'the_content', - function( $content ) use ( &$result, $context ) { + function ( $content ) use ( &$result, $context ) { $attr = $this->get_width_height_for_high_priority(); $result = wp_get_loading_optimization_attributes( 'img', $attr, $context ); return $content; @@ -4805,7 +4805,7 @@ public function test_wp_get_attachment_image_context_filter_value_is_passed_corr // Add a filter that modifies the context. add_filter( 'wp_get_attachment_image_context', - static function() { + static function () { return 'my_custom_context'; } ); @@ -5208,7 +5208,7 @@ public function test_wp_maybe_add_fetchpriority_high_attr_min_priority_filter() add_filter( 'wp_min_priority_img_pixels', - static function( $res ) { + static function ( $res ) { return 2500; // 50*50=2500 } ); @@ -5281,7 +5281,7 @@ public function test_wp_get_loading_optimization_attributes_image_before_loop_in private function track_last_attachment_image_context( &$last_context ) { add_filter( 'wp_get_attachment_image_context', - static function( $context ) use ( &$last_context ) { + static function ( $context ) use ( &$last_context ) { $last_context = $context; return $context; }, @@ -5336,7 +5336,7 @@ public function image_editor_change_quality_low_jpeg( $quality, $mime_type ) { public function force_omit_loading_attr_threshold( $threshold ) { add_filter( 'wp_omit_loading_attr_threshold', - static function() use ( $threshold ) { + static function () use ( $threshold ) { return $threshold; } ); diff --git a/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php index 82fe7dabd61b2..fee7ebb5776eb 100644 --- a/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php +++ b/tests/phpunit/tests/media/wpGenerateAttachmentMetadata.php @@ -73,7 +73,7 @@ public function test_wp_generate_attachment_metadata_includes_filesize_in_psd_me // PSD mime type is not allowed by default on multisite. add_filter( 'upload_mimes', - static function( $mimes ) { + static function ( $mimes ) { $mimes['psd'] = 'application/octet-stream'; return $mimes; } diff --git a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php index 3ffe1bc6b4a19..7011d816da1ab 100644 --- a/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php +++ b/tests/phpunit/tests/media/wpImageTagAddDecodingAttr.php @@ -25,7 +25,7 @@ public function test_should_add_decoding_attr( $image, $context, $decoding, $exp if ( 'no value' !== $decoding ) { add_filter( 'wp_img_tag_add_decoding_attr', - static function( $value ) use ( $decoding ) { + static function ( $value ) use ( $decoding ) { return $decoding; } ); @@ -86,7 +86,7 @@ public function test_should_not_add_decoding_attr( $image, $context, $decoding, if ( 'no value' !== $decoding ) { add_filter( 'wp_img_tag_add_decoding_attr', - static function( $value ) use ( $decoding ) { + static function ( $value ) use ( $decoding ) { return $decoding; } ); diff --git a/tests/phpunit/tests/menu/walker-nav-menu.php b/tests/phpunit/tests/menu/walker-nav-menu.php index 1fa255ef61305..878bf12cc4c4b 100644 --- a/tests/phpunit/tests/menu/walker-nav-menu.php +++ b/tests/phpunit/tests/menu/walker-nav-menu.php @@ -101,7 +101,7 @@ public function test_start_el_with_empty_attributes( $value, $expected ) { add_filter( 'nav_menu_link_attributes', - static function( $atts ) use ( $value ) { + static function ( $atts ) use ( $value ) { $atts['data-test'] = $value; return $atts; } diff --git a/tests/phpunit/tests/post/getPages.php b/tests/phpunit/tests/post/getPages.php index c18ce8ba64dc1..ad55f28874d34 100644 --- a/tests/phpunit/tests/post/getPages.php +++ b/tests/phpunit/tests/post/getPages.php @@ -344,7 +344,7 @@ public function test_get_pages_test_filter() { // Filter the query to return the wptests_pt post type. add_filter( 'get_pages_query_args', - static function( $query_args, $parsed_args ) use ( &$query_args_values, &$parsed_args_values ) { + static function ( $query_args, $parsed_args ) use ( &$query_args_values, &$parsed_args_values ) { $query_args['post_type'] = 'wptests_pt'; $query_args_values = $query_args; $parsed_args_values = $parsed_args; diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php index 8bdcb399b4a46..a4e45aefcf349 100644 --- a/tests/phpunit/tests/post/revisions.php +++ b/tests/phpunit/tests/post/revisions.php @@ -883,7 +883,7 @@ public function test_wp_save_post_revision_should_respect_revisions_before_delet add_filter( 'wp_revisions_to_keep', - static function() { + static function () { return 1; } ); diff --git a/tests/phpunit/tests/post/thumbnails.php b/tests/phpunit/tests/post/thumbnails.php index 44801059a88ac..b06ec025708cf 100644 --- a/tests/phpunit/tests/post/thumbnails.php +++ b/tests/phpunit/tests/post/thumbnails.php @@ -571,7 +571,7 @@ public function test_get_the_post_thumbnail_should_remove_the_post_thumbnail_con private function track_last_attachment_image_context( &$last_context ) { add_filter( 'wp_get_attachment_image_context', - static function( $context ) use ( &$last_context ) { + static function ( $context ) use ( &$last_context ) { $last_context = $context; return $context; }, diff --git a/tests/phpunit/tests/post/walkerPage.php b/tests/phpunit/tests/post/walkerPage.php index a5a632dcdaa85..d8a2312a54eff 100644 --- a/tests/phpunit/tests/post/walkerPage.php +++ b/tests/phpunit/tests/post/walkerPage.php @@ -33,7 +33,7 @@ public function test_start_el_with_empty_attributes( $value, $expected ) { add_filter( 'page_menu_link_attributes', - static function( $atts ) use ( $value ) { + static function ( $atts ) use ( $value ) { $atts['data-test'] = $value; return $atts; } diff --git a/tests/phpunit/tests/post/wpGetAttachmentLink.php b/tests/phpunit/tests/post/wpGetAttachmentLink.php index 2d658e002e572..141b8a2427af4 100644 --- a/tests/phpunit/tests/post/wpGetAttachmentLink.php +++ b/tests/phpunit/tests/post/wpGetAttachmentLink.php @@ -41,7 +41,7 @@ public function test_should_apply_attributes_filter( $attributes, $expected ) { add_filter( 'wp_get_attachment_link_attributes', - static function( $attr ) use ( $attributes ) { + static function ( $attr ) use ( $attributes ) { return array_merge( $attr, $attributes ); } ); diff --git a/tests/phpunit/tests/query.php b/tests/phpunit/tests/query.php index 52c6ebfc12ec1..37dd51a06392a 100644 --- a/tests/phpunit/tests/query.php +++ b/tests/phpunit/tests/query.php @@ -730,7 +730,7 @@ public function test_get_queried_object_should_work_for_author_name_before_get_p public function test_posts_clauses_filter_should_receive_filtered_clauses() { add_filter( 'posts_join_paged', - static function() { + static function () { return '/* posts_join_paged */'; } ); @@ -755,7 +755,7 @@ static function() { public function test_posts_clauses_request_filter_should_receive_filtered_clauses() { add_filter( 'posts_join_request', - static function() { + static function () { return '/* posts_join_request */'; } ); diff --git a/tests/phpunit/tests/query/conditionals.php b/tests/phpunit/tests/query/conditionals.php index 8eed70288bc14..05278ffd7a4cd 100644 --- a/tests/phpunit/tests/query/conditionals.php +++ b/tests/phpunit/tests/query/conditionals.php @@ -1641,14 +1641,14 @@ public function data_conditional_tags_trigger_doing_it_wrong_and_return_false_if // Get the list of `is_*()` conditional tags. $functions = array_filter( get_class_methods( 'WP_Query' ), - static function( $function_name ) { + static function ( $function_name ) { return str_starts_with( $function_name, 'is_' ); } ); // Wrap each function name in an array. $functions = array_map( - static function( $function_name ) { + static function ( $function_name ) { return array( $function_name ); }, $functions diff --git a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php index 0515c31512d3c..96d1b193bbb73 100644 --- a/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php +++ b/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php @@ -961,7 +961,7 @@ public function test_introspect_item_password_invalid() { $this->setup_app_password_authenticated_request(); add_action( 'application_password_did_authenticate', - static function() { + static function () { $GLOBALS['wp_rest_application_password_uuid'] = 'invalid_uuid'; } ); diff --git a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php index c3cac6011e491..f61b317240532 100644 --- a/tests/phpunit/tests/rest-api/rest-block-directory-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-directory-controller.php @@ -359,7 +359,7 @@ private function get_mock_plugin() { private function mock_remote_request( array $expected ) { add_filter( 'pre_http_request', - static function() use ( $expected ) { + static function () use ( $expected ) { $default = array( 'headers' => array(), 'response' => array( diff --git a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php index 3c79da56510d3..3573ecb6e0bea 100644 --- a/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php +++ b/tests/phpunit/tests/rest-api/rest-block-renderer-controller.php @@ -429,7 +429,7 @@ public function test_get_item() { public function test_get_item_with_pre_render_block_filter() { wp_set_current_user( self::$user_id ); - $pre_render_filter = static function( $output, $block ) { + $pre_render_filter = static function ( $output, $block ) { if ( $block['blockName'] === self::$block_name ) { return '

Alternate content.

'; } diff --git a/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php b/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php index d8f15013b99b8..eda42beebe25f 100644 --- a/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php +++ b/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php @@ -310,7 +310,7 @@ public function test_get_items_prepare_filter() { // Test that filter changes uncached values. add_filter( 'rest_prepare_block_pattern', - static function( $response ) { + static function ( $response ) { return 'initial value'; } ); @@ -324,7 +324,7 @@ static function( $response ) { // Test that filter changes cached values (the previous request primed the cache). add_filter( 'rest_prepare_block_pattern', - static function( $response ) { + static function ( $response ) { return 'modified the cache'; }, 11 diff --git a/tests/phpunit/tests/rest-api/rest-plugins-controller.php b/tests/phpunit/tests/rest-api/rest-plugins-controller.php index 1375c81061b8e..1da20c83159d4 100644 --- a/tests/phpunit/tests/rest-api/rest-plugins-controller.php +++ b/tests/phpunit/tests/rest-api/rest-plugins-controller.php @@ -537,7 +537,7 @@ public function test_create_item_unknown_plugin() { wp_set_current_user( self::$super_admin ); add_filter( 'pre_http_request', - static function() { + static function () { /* * Mocks the request to: * https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Bslug%5D=alex-says-this-block-definitely-doesnt-exist&request%5Bfields%5D%5Bsections%5D=0&request%5Bfields%5D%5Blanguage_packs%5D=1&request%5Blocale%5D=en_US&request%5Bwp_version%5D=5.9 diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php index 2142e805820a6..11d06b86bef74 100644 --- a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php +++ b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php @@ -2742,7 +2742,7 @@ public function test_boolean_meta_update_to_false_stores_0() { 'single' => true, 'type' => 'boolean', 'show_in_rest' => true, - 'sanitize_callback' => static function( $value ) { + 'sanitize_callback' => static function ( $value ) { return $value ? '1' : '0'; }, ) diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php index 92d1262195456..3b584642956eb 100644 --- a/tests/phpunit/tests/rest-api/rest-posts-controller.php +++ b/tests/phpunit/tests/rest-api/rest-posts-controller.php @@ -2278,7 +2278,7 @@ public function test_prepare_item_limit_fields() { */ public function test_prepare_item_filters_content_when_needed() { $filter_count = 0; - $filter_content = static function() use ( &$filter_count ) { + $filter_content = static function () use ( &$filter_count ) { ++$filter_count; return '

Filtered content.

'; }; @@ -2314,7 +2314,7 @@ public function test_prepare_item_filters_content_when_needed() { */ public function test_prepare_item_skips_content_filter_if_not_needed() { $filter_count = 0; - $filter_content = static function() use ( &$filter_count ) { + $filter_content = static function () use ( &$filter_count ) { ++$filter_count; return '

Filtered content.

'; }; diff --git a/tests/phpunit/tests/rest-api/rest-server.php b/tests/phpunit/tests/rest-api/rest-server.php index 9a12c2247b388..5f49a62fe23db 100644 --- a/tests/phpunit/tests/rest-api/rest-server.php +++ b/tests/phpunit/tests/rest-api/rest-server.php @@ -937,7 +937,7 @@ public function test_link_embedding_without_links() { * @ticket 56566 */ public function test_link_embedding_returning_wp_error() { - $return_wp_error = static function() { + $return_wp_error = static function () { return new WP_Error( 'some-error', 'This is not valid!' ); }; add_filter( 'rest_pre_dispatch', $return_wp_error ); @@ -1671,7 +1671,7 @@ public function test_get_routes_no_namespace_overriding() { '/test', array( 'methods' => array( 'GET' ), - 'callback' => static function() { + 'callback' => static function () { return new WP_REST_Response( 'data', 204 ); }, 'permission_callback' => '__return_true', @@ -1682,7 +1682,7 @@ public function test_get_routes_no_namespace_overriding() { '/test', array( 'methods' => array( 'GET' ), - 'callback' => static function() { + 'callback' => static function () { return new WP_REST_Response( 'data', 204 ); }, 'permission_callback' => '__return_true', @@ -2080,7 +2080,7 @@ public function test_batch_v1_partial_error() { public function test_batch_v1_max_requests() { add_filter( 'rest_get_max_batch_size', - static function() { + static function () { return 5; } ); @@ -2188,7 +2188,7 @@ public function test_json_encode_error_results_in_500_status_code() { array( array( 'methods' => \WP_REST_Server::READABLE, - 'callback' => static function() { + 'callback' => static function () { return new \WP_REST_Response( INF ); }, 'permission_callback' => '__return_true', diff --git a/tests/phpunit/tests/rest-api/rest-widget-types-controller.php b/tests/phpunit/tests/rest-api/rest-widget-types-controller.php index e9b46d444f371..cac586447e385 100644 --- a/tests/phpunit/tests/rest-api/rest-widget-types-controller.php +++ b/tests/phpunit/tests/rest-api/rest-widget-types-controller.php @@ -161,7 +161,7 @@ public function test_get_items_removes_duplicates() { $data = $response->get_data(); $text_widgets = array_filter( $data, - static function( $widget ) { + static function ( $widget ) { return 'text' === $widget['id']; } ); @@ -189,7 +189,7 @@ public function test_get_widget_legacy() { wp_register_sidebar_widget( $widget_id, 'WP legacy widget', - static function() {} + static function () {} ); wp_set_current_user( self::$admin_id ); $request = new WP_REST_Request( 'GET', '/wp/v2/widget-types/' . $widget_id ); @@ -220,7 +220,7 @@ public function test_get_widgets_decodes_html_entities() { wp_register_sidebar_widget( $widget_id, '‘Legacy ‑ Archive ‑ Widget’', - static function() {}, + static function () {}, array( 'description' => '“A great & interesting archive of your site’s posts!”', ) diff --git a/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php b/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php index d8118210526e6..27f526f9d230e 100644 --- a/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php +++ b/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php @@ -296,7 +296,7 @@ public function test_can_filter_http_request_args_via_filter() { add_filter( 'rest_url_details_http_request_args', - static function( $args, $url ) { + static function ( $args, $url ) { return array_merge( $args, array( @@ -339,7 +339,7 @@ public function test_will_return_from_cache_if_populated() { // Force cache to return a known value as the remote URL http response body. add_filter( "pre_site_transient_{$transient_name}", - static function() { + static function () { return 'This value from cache.'; } ); @@ -367,7 +367,7 @@ static function() { public function test_allows_filtering_data_retrieved_for_a_given_url() { add_filter( 'rest_prepare_url_details', - static function( $response ) { + static function ( $response ) { $data = $response->get_data(); @@ -417,7 +417,7 @@ public function test_allows_filtering_response() { */ add_filter( 'rest_prepare_url_details', - static function( $response, $url ) { + static function ( $response, $url ) { return new WP_REST_Response( array( 'status' => 418, diff --git a/tests/phpunit/tests/robots.php b/tests/phpunit/tests/robots.php index 87b0e6fb905e0..356224e79b51d 100644 --- a/tests/phpunit/tests/robots.php +++ b/tests/phpunit/tests/robots.php @@ -39,7 +39,7 @@ public function test_wp_robots_renders_when_relevant() { public function test_wp_robots_parses_directives_correctly() { add_filter( 'wp_robots', - static function( array $robots ) { + static function ( array $robots ) { // Directives that should have values must use strings. $robots['directive-with-value'] = 'yes'; $robots['directive-with-numeric-value'] = '1'; diff --git a/tests/phpunit/tests/term/getTermLink.php b/tests/phpunit/tests/term/getTermLink.php index 2a92d8afee78a..94307ba6970a4 100644 --- a/tests/phpunit/tests/term/getTermLink.php +++ b/tests/phpunit/tests/term/getTermLink.php @@ -259,7 +259,7 @@ public function test_term_link_filter_should_receive_term_object( $taxonomy, $us add_filter( 'term_link', - function( $location, $term ) { + function ( $location, $term ) { $this->assertInstanceOf( 'WP_Term', $term ); }, 10, diff --git a/tests/phpunit/tests/theme/customHeader.php b/tests/phpunit/tests/theme/customHeader.php index f78f6fc2af326..b994d7f2dcfe5 100644 --- a/tests/phpunit/tests/theme/customHeader.php +++ b/tests/phpunit/tests/theme/customHeader.php @@ -98,7 +98,7 @@ public function test_get_header_image_from_theme_mod() { public function test_filter_header_image( $header_image, $expected ) { add_filter( 'get_header_image', - static function() use ( $header_image ) { + static function () use ( $header_image ) { return $header_image; } ); @@ -190,7 +190,7 @@ public function test_get_header_image_tag_with_default_performance_attributes() add_filter( 'wp_min_priority_img_pixels', - static function() { + static function () { return 2500; // 50*50=2500 } ); diff --git a/tests/phpunit/tests/theme/wpThemeJsonResolver.php b/tests/phpunit/tests/theme/wpThemeJsonResolver.php index f581a1dca212e..795f72815ad84 100644 --- a/tests/phpunit/tests/theme/wpThemeJsonResolver.php +++ b/tests/phpunit/tests/theme/wpThemeJsonResolver.php @@ -600,7 +600,7 @@ public function test_get_user_data_from_wp_global_styles_does_not_use_uncached_q $global_styles_query_count = 0; add_filter( 'query', - static function( $query ) use ( &$global_styles_query_count ) { + static function ( $query ) use ( &$global_styles_query_count ) { if ( preg_match( '#post_type = \'wp_global_styles\'#', $query ) ) { $global_styles_query_count++; } @@ -836,7 +836,7 @@ public function test_get_merged_data_returns_origin( $origin, $core_palette, $co $styles = $theme_json->get_styles_block_nodes(); $styles = array_filter( $styles, - static function( $element ) { + static function ( $element ) { return isset( $element['name'] ) && 'my/block-with-styles' === $element['name']; } ); diff --git a/tests/phpunit/tests/user/queryCache.php b/tests/phpunit/tests/user/queryCache.php index d8d26286a716a..7e63907f74290 100644 --- a/tests/phpunit/tests/user/queryCache.php +++ b/tests/phpunit/tests/user/queryCache.php @@ -421,7 +421,7 @@ public function test_query_cache_do_not_cache() { $q1 = new WP_User_Query( $args ); $found1 = $q1->get_results(); - $callback = static function( $user ) { + $callback = static function ( $user ) { return (array) $user; }; diff --git a/tests/phpunit/tests/user/retrievePassword.php b/tests/phpunit/tests/user/retrievePassword.php index 861a2d9e96c01..c0f6f28c30322 100644 --- a/tests/phpunit/tests/user/retrievePassword.php +++ b/tests/phpunit/tests/user/retrievePassword.php @@ -52,7 +52,7 @@ public function test_retrieve_password_reset_notification_email() { public function test_retrieve_password_should_return_wp_error_on_failed_email() { add_filter( 'retrieve_password_notification_email', - static function() { + static function () { return array( 'message' => '' ); } ); diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index fd3826ec3dc67..ab4115cff2e26 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -596,7 +596,7 @@ public function test_widget_display_callback_handles_arrayobject() { add_filter( "pre_option_{$widget->option_name}", - static function() { + static function () { return new ArrayObject( array( 2 => array( 'title' => 'Test Title' ),