Skip to content

Commit ca2a61f

Browse files
committed
Break up conditions into multiple lines and remove redundant args
1 parent f3c8e60 commit ca2a61f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

plugins/webp-uploads/hooks.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,10 @@ function webp_uploads_filter_block_background_images( $block_content, array $blo
800800

801801
// Abort if there is no associated background image.
802802
if (
803-
! isset( $attachment_id, $image_url ) || $attachment_id <= 0 || '' === $image_url || ! is_array( wp_get_attachment_metadata( $attachment_id ) )
803+
! isset( $attachment_id, $image_url ) ||
804+
$attachment_id <= 0 ||
805+
'' === $image_url ||
806+
! is_array( wp_get_attachment_metadata( $attachment_id ) )
804807
) {
805808
return $block_content;
806809
}

plugins/webp-uploads/tests/test-block-background-images.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function test_cover_block_background_image_not_changed_without_webp_sourc
141141
$transforms['image/jpeg'] = array( 'image/jpeg' );
142142
return $transforms;
143143
};
144-
add_filter( 'webp_uploads_upload_image_mime_transforms', $filter, 10 );
144+
add_filter( 'webp_uploads_upload_image_mime_transforms', $filter );
145145

146146
$attachment_id = $this->create_jpeg_attachment();
147147
$original_url = wp_get_attachment_image_url( $attachment_id, 'full' );
@@ -150,7 +150,7 @@ public function test_cover_block_background_image_not_changed_without_webp_sourc
150150
$generated = $this->generate_block_with_background( 'core/cover', $attachment_id, $original_url );
151151
$filtered = webp_uploads_filter_block_background_images( $generated['block_content'], $generated['block'] );
152152

153-
remove_filter( 'webp_uploads_upload_image_mime_transforms', $filter, 10 );
153+
remove_filter( 'webp_uploads_upload_image_mime_transforms', $filter );
154154

155155
$this->assertSame( $generated['block_content'], $filtered, 'Background image should remain unchanged when no WebP source exists.' );
156156
$this->assertStringNotContainsString( '-jpg.webp', $filtered );

0 commit comments

Comments
 (0)