@@ -85,7 +85,7 @@ function auto_sizes_filter_image_tag( $content, array $parsed_block, WP_Block $b
85
85
$ id = $ block ->attributes ['id ' ] ?? 0 ;
86
86
$ alignment = $ block ->attributes ['align ' ] ?? '' ;
87
87
$ width = $ block ->attributes ['width ' ] ?? '' ;
88
- $ max_alignment = $ block ->context ['max_alignment ' ];
88
+ $ max_alignment = $ block ->context ['max_alignment ' ] ?? '' ;
89
89
90
90
/*
91
91
* Update width for cover block.
@@ -132,11 +132,11 @@ function auto_sizes_filter_image_tag( $content, array $parsed_block, WP_Block $b
132
132
*
133
133
* @since n.e.x.t
134
134
*
135
- * @param int $id The image id .
136
- * @param string|int[] $size The image size data .
137
- * @param string $align The image alignment.
138
- * @param string $resize_width Resize image width.
139
- * @param string $max_alignment The maximum usable layout alignment.
135
+ * @param int $id The image attachment post ID .
136
+ * @param string|array{ int, int} $size Image size name or array of width and height .
137
+ * @param string $align The image alignment.
138
+ * @param string $resize_width Resize image width.
139
+ * @param string $max_alignment The maximum usable layout alignment.
140
140
* @return string|false An improved sizes attribute or false if a better size cannot be calculated.
141
141
*/
142
142
function auto_sizes_calculate_better_sizes ( int $ id , $ size , string $ align , string $ resize_width , string $ max_alignment ) {
@@ -166,7 +166,7 @@ function auto_sizes_calculate_better_sizes( int $id, $size, string $align, strin
166
166
}
167
167
168
168
// Normalize default alignment values.
169
- $ align = ( bool ) $ align ? $ align : 'default ' ;
169
+ $ align = '' !== $ align ? $ align : 'default ' ;
170
170
171
171
/*
172
172
* Map alignment values to a weighting value so they can be compared.
@@ -238,9 +238,9 @@ function auto_sizes_get_layout_width( string $alignment ): string {
238
238
*
239
239
* @since n.e.x.t
240
240
*
241
- * @param array< string> $uses_context Array of registered uses context for a block type.
241
+ * @param string[] $uses_context Array of registered uses context for a block type.
242
242
* @param WP_Block_Type $block_type The full block type object.
243
- * @return array< string> The filtered context keys used by the block type.
243
+ * @return string[] The filtered context keys used by the block type.
244
244
*/
245
245
function auto_sizes_filter_uses_context ( array $ uses_context , WP_Block_Type $ block_type ): array {
246
246
// The list of blocks that can consume outer layout context.
0 commit comments