@@ -430,20 +430,15 @@ public function regular_tag_replace( $new_tag, $original_url, $new_url, $optml_a
430430 /**
431431 * Replace image URLs in the srcset attributes and in case there is a resize in action, also replace the sizes.
432432 *
433- * @param array $sources Array of image sources.
434- * @param array $size_array Array of width and height values in pixels (in that order).
435- * @param string $image_src The 'src' of the image.
436- * @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
437- * @param int $attachment_id Image attachment ID.
433+ * @param array<int, array{url: string, descriptor: string, value: int}> $sources Array of image sources.
434+ * @param array{0: int, 1: int}|int[] $size_array Array of width and height values in pixels (in that order).
435+ * @param string $image_src The 'src' of the image.
436+ * @param array<string, mixed> $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
437+ * @param int $attachment_id Image attachment ID or 0 .
438438 *
439439 * @return array
440440 */
441441 public function filter_srcset_attr ( $ sources = [], $ size_array = [], $ image_src = '' , $ image_meta = [], $ attachment_id = 0 ) {
442-
443- if ( ! is_array ( $ sources ) ) {
444- return $ sources ;
445- }
446-
447442 if ( Optml_Media_Offload::is_uploaded_image ( $ image_src ) ) {
448443 return $ sources ;
449444 }
@@ -513,10 +508,10 @@ public function filter_srcset_attr( $sources = [], $size_array = [], $image_src
513508 /**
514509 * Filters sizes attribute of the images.
515510 *
516- * @param array $sizes An array of media query breakpoints.
517- * @param array $size Width and height of the image.
511+ * @param string $sizes An array of media query breakpoints.
512+ * @param string|int[] $size Width and height of the image.
518513 *
519- * @return mixed An array of media query breakpoints.
514+ * @return string An array of media query breakpoints.
520515 */
521516 public function filter_sizes_attr ( $ sizes , $ size ) {
522517
0 commit comments