From eb6b517aec3e04b1868a4ea4e4eb01a6a08a3751 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 12 Aug 2021 19:29:43 +0000 Subject: [PATCH] Docs: Synchronize documentation for `wp_get_attachment_image_attributes` filter callbacks in bundled themes: * Twenty Sixteen: Correct the `$attachment` parameter type, use typed array notation. * Twenty Seventeen: Correct the `$attachment` parameter type, use typed array notation. * Twenty Nineteen: Correct the `@return` value type, use typed array notation. * Twenty Twenty-One: Add missing `@return` value description, use typed array notation. Follow-up to [29836], [47249], [49021], [49597]. Props ankitmaru, mukesh27, SergeyBiryukov. Fixes #53878. git-svn-id: https://develop.svn.wordpress.org/trunk@51607 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentynineteen/inc/template-functions.php | 7 ++++--- src/wp-content/themes/twentyseventeen/functions.php | 10 ++++++---- src/wp-content/themes/twentysixteen/functions.php | 10 ++++++---- .../themes/twentytwentyone/inc/template-functions.php | 8 ++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/wp-content/themes/twentynineteen/inc/template-functions.php b/src/wp-content/themes/twentynineteen/inc/template-functions.php index aa4e62cd64..301ac23116 100644 --- a/src/wp-content/themes/twentynineteen/inc/template-functions.php +++ b/src/wp-content/themes/twentynineteen/inc/template-functions.php @@ -96,12 +96,13 @@ function twentynineteen_get_the_archive_title() { add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' ); /** - * Add custom sizes attribute to responsive image functionality for post thumbnails. + * Add custom 'sizes' attribute to responsive image functionality for post thumbnails. * * @origin Twenty Nineteen 1.0 * - * @param array $attr Attributes for the image markup. - * @return string Value for use in post thumbnail 'sizes' attribute. + * @param string[] $attr Array of attribute values for the image markup, keyed by attribute name. + * See wp_get_attachment_image(). + * @return string[] The filtered attributes for the image markup. */ function twentynineteen_post_thumbnail_sizes_attr( $attr ) { diff --git a/src/wp-content/themes/twentyseventeen/functions.php b/src/wp-content/themes/twentyseventeen/functions.php index c99a8c9a91..3e0ddc9991 100644 --- a/src/wp-content/themes/twentyseventeen/functions.php +++ b/src/wp-content/themes/twentyseventeen/functions.php @@ -573,10 +573,12 @@ add_filter( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 ); * * @since Twenty Seventeen 1.0 * - * @param array $attr Attributes for the image markup. - * @param int $attachment Image attachment ID. - * @param array $size Registered image size or flat array of height and width dimensions. - * @return array The filtered attributes for the image markup. + * @param string[] $attr Array of attribute values for the image markup, keyed by attribute name. + * See wp_get_attachment_image(). + * @param WP_Post $attachment Image attachment post. + * @param string|int[] $size Requested image size. Can be any registered image size name, or + * an array of width and height values in pixels (in that order). + * @return string[] The filtered attributes for the image markup. */ function twentyseventeen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { if ( is_archive() || is_search() || is_home() ) { diff --git a/src/wp-content/themes/twentysixteen/functions.php b/src/wp-content/themes/twentysixteen/functions.php index b5b7c207a9..a6207071c5 100644 --- a/src/wp-content/themes/twentysixteen/functions.php +++ b/src/wp-content/themes/twentysixteen/functions.php @@ -559,10 +559,12 @@ add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr' * * @since Twenty Sixteen 1.0 * - * @param array $attr Attributes for the image markup. - * @param int $attachment Image attachment ID. - * @param array $size Registered image size or flat array of height and width dimensions. - * @return array The filtered attributes for the image markup. + * @param string[] $attr Array of attribute values for the image markup, keyed by attribute name. + * See wp_get_attachment_image(). + * @param WP_Post $attachment Image attachment post. + * @param string|int[] $size Requested image size. Can be any registered image size name, or + * an array of width and height values in pixels (in that order). + * @return string[] The filtered attributes for the image markup. */ function twentysixteen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { if ( 'post-thumbnail' === $size ) { diff --git a/src/wp-content/themes/twentytwentyone/inc/template-functions.php b/src/wp-content/themes/twentytwentyone/inc/template-functions.php index 1e61ba3054..839a77a368 100644 --- a/src/wp-content/themes/twentytwentyone/inc/template-functions.php +++ b/src/wp-content/themes/twentytwentyone/inc/template-functions.php @@ -432,12 +432,12 @@ add_filter( 'the_password_form', 'twenty_twenty_one_password_form', 10, 2 ); * * @since Twenty Twenty-One 1.0 * - * @param array $attr Array of attribute values for the image markup, keyed by attribute name. + * @param string[] $attr Array of attribute values for the image markup, keyed by attribute name. * See wp_get_attachment_image(). * @param WP_Post $attachment Image attachment post. - * @param string|array $size Requested size. Image size or array of width and height values - * (in that order). Default 'thumbnail'. - * @return array + * @param string|int[] $size Requested image size. Can be any registered image size name, or + * an array of width and height values in pixels (in that order). + * @return string[] The filtered attributes for the image markup. */ function twenty_twenty_one_get_attachment_image_attributes( $attr, $attachment, $size ) {