From 2181d884305abce6a95182fc8b037beed747bd9b Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 9 Jan 2024 14:32:21 -0800 Subject: [PATCH] Revert test changes moved to #924 --- phpcs.xml.dist | 36 ++------------ tests/admin/load-tests.php | 2 +- tests/admin/server-timing-tests.php | 2 +- tests/bootstrap.php | 2 +- tests/load-tests.php | 14 +++--- .../audit-autoloaded-options-test.php | 1 + .../dominant-color-test.php | 4 +- .../images/webp-uploads/helper-tests.php | 3 +- .../images/webp-uploads/load-tests.php | 6 +-- .../images/webp-uploads/rest-api-tests.php | 2 +- .../audit-enqueued-assets-helper-test.php | 4 +- .../audit-enqueued-assets-test.php | 25 ++-------- tests/server-timing/load-tests.php | 48 +++++-------------- .../perflab-server-timing-tests.php | 22 ++++----- .../something/demo-module-2/activate.php | 2 +- .../something/demo-module-2/deactivate.php | 2 +- .../class-audit-assets-transients-set.php | 1 + .../class-site-health-mock-responses.php | 1 + tests/utils/Constraint/ImageHasSizeSource.php | 1 + tests/utils/Constraint/ImageHasSource.php | 1 + tests/utils/TestCase/ImagesTestCase.php | 2 +- 21 files changed, 57 insertions(+), 124 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c6fa03962a..9b34e57217 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -6,7 +6,9 @@ - + + tests/* + @@ -71,37 +73,5 @@ tests/utils/* - - - tests/* - - - tests/* - - - tests/* - - - tests/* - - - tests/* - - - tests/* - - - - - - - - - - - - - - diff --git a/tests/admin/load-tests.php b/tests/admin/load-tests.php index 5f139c939d..9e39ad44e3 100644 --- a/tests/admin/load-tests.php +++ b/tests/admin/load-tests.php @@ -84,7 +84,7 @@ public function test_perflab_add_modules_page() { remove_all_filters( 'plugin_action_links_' . plugin_basename( PERFLAB_MAIN_FILE ) ); // Does not register the page if the perflab_active_modules filter is used. - add_filter( 'perflab_active_modules', '__return_empty_array' ); + add_filter( 'perflab_active_modules', '__return_null' ); $hook_suffix = perflab_add_modules_page(); $this->assertFalse( $hook_suffix ); $this->assertFalse( isset( $_wp_submenu_nopriv['options-general.php'][ PERFLAB_MODULES_SCREEN ] ) ); diff --git a/tests/admin/server-timing-tests.php b/tests/admin/server-timing-tests.php index 38cb55a89c..915da3cdc7 100644 --- a/tests/admin/server-timing-tests.php +++ b/tests/admin/server-timing-tests.php @@ -49,7 +49,7 @@ public function test_perflab_load_server_timing_page() { perflab_load_server_timing_page(); $this->assertArrayHasKey( PERFLAB_SERVER_TIMING_SCREEN, $wp_settings_sections ); $expected_sections = array( 'benchmarking' ); - if ( ! has_filter( 'template_include', 'ilo_buffer_output' ) ) { + if ( ! has_filter( 'template_include', 'image_loading_optimization_buffer_output' ) ) { $expected_sections[] = 'output-buffering'; } $this->assertEqualSets( diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3018bda910..9a7fc87a18 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -41,7 +41,7 @@ require_once $_test_root . '/includes/functions.php'; tests_add_filter( 'plugins_loaded', - static function () { + static function() { require_once TESTS_PLUGIN_DIR . '/admin/load.php'; require_once TESTS_PLUGIN_DIR . '/admin/server-timing.php'; $module_files = glob( TESTS_PLUGIN_DIR . '/modules/*/*/load.php' ); diff --git a/tests/load-tests.php b/tests/load-tests.php index 6c7dd2fc2d..5f2ceedc5c 100644 --- a/tests/load-tests.php +++ b/tests/load-tests.php @@ -78,10 +78,10 @@ public function test_perflab_get_module_settings() { $has_passed_default = false; add_filter( 'default_option_' . PERFLAB_MODULES_SETTING, - static function ( $current_default, $option, $passed_default ) use ( &$has_passed_default ) { + static function( $default, $option, $passed_default ) use ( &$has_passed_default ) { // This callback just records whether there is a default value being passed. $has_passed_default = $passed_default; - return $current_default; + return $default; }, 10, 3 @@ -134,7 +134,7 @@ public function test_perflab_get_active_modules() { $expected_active_modules = array_keys( array_filter( perflab_get_modules_setting_default(), - static function ( $module_settings ) { + static function( $module_settings ) { return $module_settings['enabled']; } ) @@ -158,7 +158,7 @@ public function test_perflab_get_generator_content() { array_pop( $active_modules ); add_filter( 'perflab_active_modules', - static function () use ( $active_modules ) { + static function() use ( $active_modules ) { return $active_modules; } ); @@ -229,7 +229,7 @@ private function get_expected_default_option() { $default_enabled_modules = require PERFLAB_PLUGIN_DIR_PATH . 'default-enabled-modules.php'; return array_reduce( $default_enabled_modules, - static function ( $module_settings, $module_dir ) { + static function( $module_settings, $module_dir ) { $module_settings[ $module_dir ] = array( 'enabled' => true ); return $module_settings; }, @@ -312,13 +312,13 @@ private function set_up_mock_filesystem() { add_filter( 'filesystem_method_file', - static function () { + static function() { return __DIR__ . '/utils/Filesystem/WP_Filesystem_MockFilesystem.php'; } ); add_filter( 'filesystem_method', - static function () { + static function() { return 'MockFilesystem'; } ); diff --git a/tests/modules/database/audit-autoloaded-options/audit-autoloaded-options-test.php b/tests/modules/database/audit-autoloaded-options/audit-autoloaded-options-test.php index 6a2586731e..3a4a238d00 100644 --- a/tests/modules/database/audit-autoloaded-options/audit-autoloaded-options-test.php +++ b/tests/modules/database/audit-autoloaded-options/audit-autoloaded-options-test.php @@ -86,3 +86,4 @@ public static function delete_autoloaded_option() { delete_option( self::AUTOLOADED_OPTION_KEY ); } } + diff --git a/tests/modules/images/dominant-color-images/dominant-color-test.php b/tests/modules/images/dominant-color-images/dominant-color-test.php index 02ebf80dc1..1bf6c77cb4 100644 --- a/tests/modules/images/dominant-color-images/dominant-color-test.php +++ b/tests/modules/images/dominant-color-images/dominant-color-test.php @@ -92,7 +92,7 @@ public function test_tag_add_adjust_to_image_attributes( $image_path, $expected_ $filtered_image_tags_added = dominant_color_img_tag_add_dominant_color( $filtered_image_mock_lazy_load, 'the_content', $attachment_id ); - $this->assertStringContainsString( 'data-has-transparency="' . wp_json_encode( $expected_transparency ) . '"', $filtered_image_tags_added ); + $this->assertStringContainsString( 'data-has-transparency="' . json_encode( $expected_transparency ) . '"', $filtered_image_tags_added ); foreach ( $expected_color as $color ) { if ( false !== strpos( $color, $filtered_image_tags_added ) ) { @@ -210,7 +210,7 @@ public function data_provider_dominant_color_check_inline_style() { public function test_dominant_color_update_attachment_image_attributes( $style_attr, $expected ) { $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); - $attachment_image = wp_get_attachment_image( $attachment_id, 'full', '', array( 'style' => $style_attr ) ); + $attachment_image = wp_get_attachment_image( $attachment_id, 'full', '', array( "style" => $style_attr ) ); $this->assertStringContainsString( $expected, $attachment_image ); } diff --git a/tests/modules/images/webp-uploads/helper-tests.php b/tests/modules/images/webp-uploads/helper-tests.php index 5ff31c75aa..a4ebe0dd58 100644 --- a/tests/modules/images/webp-uploads/helper-tests.php +++ b/tests/modules/images/webp-uploads/helper-tests.php @@ -364,7 +364,6 @@ public function it_should_return_empty_array_when_filter_returns_empty_array() { * @test */ public function it_should_return_default_transforms_when_filter_returns_non_array_type() { - /** @phpstan-ignore-next-line */ add_filter( 'webp_uploads_upload_image_mime_transforms', '__return_null' ); $default_transforms = array( @@ -521,7 +520,7 @@ public function test_webp_uploads_in_frontend_body_within_wp_head() { $result = null; add_action( 'wp_head', - static function () use ( &$result ) { + static function() use ( &$result ) { $result = webp_uploads_in_frontend_body(); } ); diff --git a/tests/modules/images/webp-uploads/load-tests.php b/tests/modules/images/webp-uploads/load-tests.php index cf8ce7e566..7251b4aced 100644 --- a/tests/modules/images/webp-uploads/load-tests.php +++ b/tests/modules/images/webp-uploads/load-tests.php @@ -544,7 +544,7 @@ public function it_should_not_replace_the_references_to_a_jpg_image_when_disable add_filter( 'webp_uploads_content_image_mimes', - static function ( $mime_types ) { + static function( $mime_types ) { unset( $mime_types[ array_search( 'image/webp', $mime_types, true ) ] ); return $mime_types; } @@ -733,7 +733,7 @@ public function it_should_prevent_replacing_an_image_uploaded_via_external_sourc add_filter( 'webp_uploads_pre_replace_additional_image_source', - static function () { + static function() { return ''; } ); @@ -899,7 +899,7 @@ public function it_should_not_add_fallback_script_if_content_has_no_updated_imag public function it_should_create_mime_types_for_allowed_sizes_only_via_filter() { add_filter( 'webp_uploads_image_sizes_with_additional_mime_type_support', - static function ( $sizes ) { + static function( $sizes ) { $sizes['allowed_size_400x300'] = true; return $sizes; } diff --git a/tests/modules/images/webp-uploads/rest-api-tests.php b/tests/modules/images/webp-uploads/rest-api-tests.php index 2dc5145d7c..b1fe715cc6 100644 --- a/tests/modules/images/webp-uploads/rest-api-tests.php +++ b/tests/modules/images/webp-uploads/rest-api-tests.php @@ -24,7 +24,7 @@ public function it_should_add_sources_to_rest_response() { add_filter( 'webp_uploads_upload_image_mime_transforms', - static function ( $transforms ) { + static function( $transforms ) { $transforms['image/jpeg'] = array( 'image/jpeg', 'image/webp' ); return $transforms; } diff --git a/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-helper-test.php b/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-helper-test.php index 7d9f45635e..fcf69cae69 100644 --- a/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-helper-test.php +++ b/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-helper-test.php @@ -101,10 +101,12 @@ public function test_perflab_aea_get_path_from_resource_url_outside_wp_setup() { $expected_path = WP_CONTENT_DIR . '/themes/test-theme/style.css'; add_filter( 'content_url', - static function () { + static function( $url ) { return site_url() . '/content'; } ); $this->assertSame( $expected_path, perflab_aea_get_path_from_resource_url( $test_url ) ); } + } + diff --git a/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-test.php b/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-test.php index cd71fd1ed0..ffe39e7fd0 100644 --- a/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-test.php +++ b/tests/modules/js-and-css/audit-enqueued-assets/audit-enqueued-assets-test.php @@ -78,6 +78,7 @@ public function test_perflab_aea_audit_enqueued_scripts() { ), $transient ); + } /** @@ -92,10 +93,8 @@ public function test_perflab_aea_audit_enqueued_styles_transient_already_set() { Audit_Assets_Transients_Set::set_style_transient_with_data( 3 ); - // Avoid deprecation warning due to related change in WordPress 6.4. - remove_action( 'wp_print_styles', 'print_emoji_styles' ); + // Avoids echoing styles. get_echo( 'wp_print_styles' ); - perflab_aea_audit_enqueued_styles(); $transient = get_transient( 'aea_enqueued_front_page_styles' ); $this->assertIsArray( $transient ); @@ -140,9 +139,6 @@ public function test_perflab_aea_audit_enqueued_styles() { $style .= "\tbackground: red;\n"; $style .= '}'; wp_add_inline_style( 'style1', $style ); - - // Avoid deprecation warning due to related change in WordPress 6.4. - remove_action( 'wp_print_styles', 'print_emoji_styles' ); get_echo( 'wp_print_styles' ); perflab_aea_audit_enqueued_styles(); @@ -241,23 +237,7 @@ public function test_perflab_aea_clean_aea_audit_action() { $_REQUEST['_wpnonce'] = wp_create_nonce( 'clean_aea_audit' ); $_GET['action'] = 'clean_aea_audit'; $this->current_user_can_view_site_health_checks_cap(); - $redirected_url = null; - add_filter( - 'wp_redirect', - static function ( $url ) use ( &$redirected_url ) { - $redirected_url = $url; - return false; - } - ); - $_REQUEST['_wp_http_referer'] = add_query_arg( - array( - '_wpnonce' => 'foo', - 'action' => 'bar', - ), - home_url( '/' ) - ); perflab_aea_clean_aea_audit_action(); - $this->assertSame( home_url( '/' ), $redirected_url ); $this->assertFalse( get_transient( 'aea_enqueued_front_page_scripts' ) ); $this->assertFalse( get_transient( 'aea_enqueued_front_page_styles' ) ); } @@ -302,3 +282,4 @@ public function mock_data_perflab_aea_enqueued_css_assets_test_callback( $number return Site_Health_Mock_Responses::return_aea_enqueued_css_assets_test_callback_more_than_threshold( $number_of_assets ); } } + diff --git a/tests/server-timing/load-tests.php b/tests/server-timing/load-tests.php index dcffb6ccdc..7d6fd3e2c7 100644 --- a/tests/server-timing/load-tests.php +++ b/tests/server-timing/load-tests.php @@ -25,7 +25,7 @@ public function test_perflab_server_timing_register_metric() { perflab_server_timing_register_metric( 'test-metric', array( - 'measure_callback' => static function ( $metric ) { + 'measure_callback' => static function( $metric ) { $metric->set_value( 100 ); }, 'access_cap' => 'exist', @@ -42,7 +42,7 @@ public function test_perflab_server_timing_use_output_buffer() { } public function test_perflab_wrap_server_timing() { - $cb = static function () { + $cb = static function() { return 123; }; @@ -64,7 +64,7 @@ public function test_perflab_register_server_timing_setting() { // Reset relevant globals. $wp_registered_settings = array(); - $new_allowed_options = array(); + $new_allowed_options = array(); perflab_register_server_timing_setting(); @@ -103,61 +103,37 @@ public function data_perflab_sanitize_server_timing_setting() { ), 'empty list, array' => array( array( 'benchmarking_actions' => array() ), - array( - 'benchmarking_actions' => array(), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array(), 'output_buffering' => false ), ), 'empty list, string' => array( array( 'benchmarking_actions' => '' ), - array( - 'benchmarking_actions' => array(), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array(), 'output_buffering' => false ), ), 'empty list, string with whitespace' => array( array( 'benchmarking_actions' => ' ' ), - array( - 'benchmarking_actions' => array(), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array(), 'output_buffering' => false ), ), 'regular list, array' => array( array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ) ), - array( - 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), 'output_buffering' => false ), ), 'regular list, string' => array( array( 'benchmarking_actions' => "after_setup_theme\ninit\nwp_loaded" ), - array( - 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), 'output_buffering' => false ), ), 'regular list, string with whitespace' => array( array( 'benchmarking_actions' => "after_setup_ theme \ninit \n\nwp_loaded\n" ), - array( - 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), 'output_buffering' => false ), ), 'regular list, array with duplicates' => array( array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded', 'init' ) ), - array( - 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array( 'after_setup_theme', 'init', 'wp_loaded' ), 'output_buffering' => false ), ), 'regular list, array with special hook chars' => array( array( 'benchmarking_actions' => array( 'namespace/hookname', 'namespace.hookname' ) ), - array( - 'benchmarking_actions' => array( 'namespace/hookname', 'namespace.hookname' ), - 'output_buffering' => false, - ), + array( 'benchmarking_actions' => array( 'namespace/hookname', 'namespace.hookname' ), 'output_buffering' => false ), ), - 'output buffering enabled' => array( + 'output buffering enabled' => array( array( 'output_buffering' => 'on' ), array( 'output_buffering' => true ), ), diff --git a/tests/server-timing/perflab-server-timing-tests.php b/tests/server-timing/perflab-server-timing-tests.php index 33d7ca28be..360d4547b1 100644 --- a/tests/server-timing/perflab-server-timing-tests.php +++ b/tests/server-timing/perflab-server-timing-tests.php @@ -38,7 +38,7 @@ public function test_register_metric_stores_metrics_and_runs_measure_callback() $this->server_timing->register_metric( 'test-metric', array( - 'measure_callback' => static function () use ( &$called ) { + 'measure_callback' => static function() use ( &$called ) { $called = true; }, 'access_cap' => 'exist', @@ -52,7 +52,7 @@ public function test_register_metric_stores_metrics_and_runs_measure_callback() public function test_register_metric_runs_measure_callback_based_on_access_cap() { $called = false; $args = array( - 'measure_callback' => static function () use ( &$called ) { + 'measure_callback' => static function() use ( &$called ) { $called = true; }, 'access_cap' => 'manage_options', // Admin capability. @@ -130,13 +130,13 @@ public function test_get_header( $expected, $metrics ) { } public function data_get_header() { - $measure_42 = static function ( $metric ) { + $measure_42 = static function( $metric ) { $metric->set_value( 42 ); }; - $measure_300 = static function ( $metric ) { + $measure_300 = static function( $metric ) { $metric->set_value( 300 ); }; - $measure_12point345 = static function ( $metric ) { + $measure_12point345 = static function( $metric ) { $metric->set_value( 12.345 ); }; @@ -188,23 +188,23 @@ public function data_get_header() { } public function get_data_to_test_use_output_buffer() { - $enable_option = static function () { - $option = (array) get_option( PERFLAB_SERVER_TIMING_SETTING ); + $enable_option = static function () { + $option = (array) get_option( PERFLAB_SERVER_TIMING_SETTING ); $option['output_buffering'] = true; update_option( PERFLAB_SERVER_TIMING_SETTING, $option ); }; $disable_option = static function () { - $option = (array) get_option( PERFLAB_SERVER_TIMING_SETTING ); + $option = (array) get_option( PERFLAB_SERVER_TIMING_SETTING ); $option['output_buffering'] = false; update_option( PERFLAB_SERVER_TIMING_SETTING, $option ); }; return array( - 'default' => array( + 'default' => array( 'set_up' => static function () {}, 'expected' => false, ), - 'option-enabled' => array( + 'option-enabled' => array( 'set_up' => $enable_option, 'expected' => true, ), @@ -212,7 +212,7 @@ public function get_data_to_test_use_output_buffer() { 'set_up' => $disable_option, 'expected' => false, ), - 'filter-enabled' => array( + 'filter-enabled' => array( 'set_up' => static function () use ( $disable_option ) { $disable_option(); add_filter( 'perflab_server_timing_use_output_buffer', '__return_true' ); diff --git a/tests/testdata/demo-modules/something/demo-module-2/activate.php b/tests/testdata/demo-modules/something/demo-module-2/activate.php index 8f85b81094..d49a00348b 100644 --- a/tests/testdata/demo-modules/something/demo-module-2/activate.php +++ b/tests/testdata/demo-modules/something/demo-module-2/activate.php @@ -6,6 +6,6 @@ * @package performance-lab */ -return static function () { +return static function() { update_option( 'test_demo_module_activation_status', 'activated' ); }; diff --git a/tests/testdata/demo-modules/something/demo-module-2/deactivate.php b/tests/testdata/demo-modules/something/demo-module-2/deactivate.php index b08dcf3c96..241717d180 100644 --- a/tests/testdata/demo-modules/something/demo-module-2/deactivate.php +++ b/tests/testdata/demo-modules/something/demo-module-2/deactivate.php @@ -6,6 +6,6 @@ * @package performance-lab */ -return static function () { +return static function() { update_option( 'test_demo_module_activation_status', 'deactivated' ); }; diff --git a/tests/testdata/modules/site-health/audit-enqueued-assets/class-audit-assets-transients-set.php b/tests/testdata/modules/site-health/audit-enqueued-assets/class-audit-assets-transients-set.php index 661ae7fe1b..b634dcf992 100644 --- a/tests/testdata/modules/site-health/audit-enqueued-assets/class-audit-assets-transients-set.php +++ b/tests/testdata/modules/site-health/audit-enqueued-assets/class-audit-assets-transients-set.php @@ -62,3 +62,4 @@ public static function set_style_transient_with_no_data() { delete_transient( self::STYLES_TRANSIENT ); } } + diff --git a/tests/testdata/modules/site-health/audit-enqueued-assets/class-site-health-mock-responses.php b/tests/testdata/modules/site-health/audit-enqueued-assets/class-site-health-mock-responses.php index 78e42b6a8b..04854898a5 100644 --- a/tests/testdata/modules/site-health/audit-enqueued-assets/class-site-health-mock-responses.php +++ b/tests/testdata/modules/site-health/audit-enqueued-assets/class-site-health-mock-responses.php @@ -177,3 +177,4 @@ public static function return_aea_enqueued_css_assets_test_callback_more_than_th return $result; } } + diff --git a/tests/utils/Constraint/ImageHasSizeSource.php b/tests/utils/Constraint/ImageHasSizeSource.php index 0688ce6c1e..4c690c7286 100644 --- a/tests/utils/Constraint/ImageHasSizeSource.php +++ b/tests/utils/Constraint/ImageHasSizeSource.php @@ -64,4 +64,5 @@ protected function matches( $attachment_id ): bool { return $this->verify_sources( $metadata['sizes'][ $this->size ]['sources'] ); } + } diff --git a/tests/utils/Constraint/ImageHasSource.php b/tests/utils/Constraint/ImageHasSource.php index 7ac978d108..2c55f01e28 100644 --- a/tests/utils/Constraint/ImageHasSource.php +++ b/tests/utils/Constraint/ImageHasSource.php @@ -136,4 +136,5 @@ protected function verify_sources( $sources ) { protected function failureDescription( $attachment_id ): string { return sprintf( 'an image %s', $this->toString() ); } + } diff --git a/tests/utils/TestCase/ImagesTestCase.php b/tests/utils/TestCase/ImagesTestCase.php index a5a62f0750..b5e4715e32 100644 --- a/tests/utils/TestCase/ImagesTestCase.php +++ b/tests/utils/TestCase/ImagesTestCase.php @@ -116,7 +116,7 @@ public static function assertSizeNameIsHashed( $size_name, $hashed_size_name, $m public function opt_in_to_jpeg_and_webp() { add_filter( 'webp_uploads_upload_image_mime_transforms', - static function ( $transforms ) { + static function( $transforms ) { $transforms['image/jpeg'] = array( 'image/jpeg', 'image/webp' ); $transforms['image/webp'] = array( 'image/webp', 'image/jpeg' ); return $transforms;