From 9b08513ce964af15249952fac59f130518e2753c Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Tue, 11 Jul 2023 06:29:11 +0000 Subject: [PATCH] Docs: Fix incorrect type for `$crop` param is various `WP_Image_Editor` classes and methods. This changeset updates the `$crop` docblock type in various `WP_Image_Editor`, `WP_Image_Editor_GD` and `WP_Image_Editor_Imagick` functions, to match the type documented in `image_resize_dimensions()`. Props thunderdw. Fixes #58271. See #57840. git-svn-id: https://develop.svn.wordpress.org/trunk@56204 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-image-editor-gd.php | 18 +++++++++--------- .../class-wp-image-editor-imagick.php | 18 +++++++++--------- src/wp-includes/class-wp-image-editor.php | 12 ++++++------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/wp-includes/class-wp-image-editor-gd.php b/src/wp-includes/class-wp-image-editor-gd.php index f9723dc66a..5f88d209a6 100644 --- a/src/wp-includes/class-wp-image-editor-gd.php +++ b/src/wp-includes/class-wp-image-editor-gd.php @@ -163,9 +163,9 @@ class WP_Image_Editor_GD extends WP_Image_Editor { * * @since 3.5.0 * - * @param int|null $max_w Image width. - * @param int|null $max_h Image height. - * @param bool $crop + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop * @return true|WP_Error */ public function resize( $max_w, $max_h, $crop = false ) { @@ -236,9 +236,9 @@ class WP_Image_Editor_GD extends WP_Image_Editor { * @type array ...$0 { * Array of height, width values, and whether to crop. * - * @type int $width Image width. Optional if `$height` is specified. - * @type int $height Image height. Optional if `$width` is specified. - * @type bool $crop Optional. Whether to crop the image. Default false. + * @type int $width Image width. Optional if `$height` is specified. + * @type int $height Image height. Optional if `$width` is specified. + * @type bool|array $crop Optional. Whether to crop the image. Default false. * } * } * @return array An array of resized images' metadata by size. @@ -265,9 +265,9 @@ class WP_Image_Editor_GD extends WP_Image_Editor { * @param array $size_data { * Array of size data. * - * @type int $width The maximum width in pixels. - * @type int $height The maximum height in pixels. - * @type bool $crop Whether to crop the image to exact dimensions. + * @type int $width The maximum width in pixels. + * @type int $height The maximum height in pixels. + * @type bool|array $crop Whether to crop the image to exact dimensions. * } * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta, * WP_Error object on error. diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php index 0df7d4180f..feb19d3507 100644 --- a/src/wp-includes/class-wp-image-editor-imagick.php +++ b/src/wp-includes/class-wp-image-editor-imagick.php @@ -308,9 +308,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * * @since 3.5.0 * - * @param int|null $max_w Image width. - * @param int|null $max_h Image height. - * @param bool $crop + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop * @return true|WP_Error */ public function resize( $max_w, $max_h, $crop = false ) { @@ -495,9 +495,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * @type array ...$0 { * Array of height, width values, and whether to crop. * - * @type int $width Image width. Optional if `$height` is specified. - * @type int $height Image height. Optional if `$width` is specified. - * @type bool $crop Optional. Whether to crop the image. Default false. + * @type int $width Image width. Optional if `$height` is specified. + * @type int $height Image height. Optional if `$width` is specified. + * @type bool|array $crop Optional. Whether to crop the image. Default false. * } * } * @return array An array of resized images' metadata by size. @@ -524,9 +524,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { * @param array $size_data { * Array of size data. * - * @type int $width The maximum width in pixels. - * @type int $height The maximum height in pixels. - * @type bool $crop Whether to crop the image to exact dimensions. + * @type int $width The maximum width in pixels. + * @type int $height The maximum height in pixels. + * @type bool|array $crop Whether to crop the image to exact dimensions. * } * @return array|WP_Error The image data array for inclusion in the `sizes` array in the image meta, * WP_Error object on error. diff --git a/src/wp-includes/class-wp-image-editor.php b/src/wp-includes/class-wp-image-editor.php index fa5a8ef178..f4976da8e4 100644 --- a/src/wp-includes/class-wp-image-editor.php +++ b/src/wp-includes/class-wp-image-editor.php @@ -104,9 +104,9 @@ abstract class WP_Image_Editor { * @since 3.5.0 * @abstract * - * @param int|null $max_w Image width. - * @param int|null $max_h Image height. - * @param bool $crop + * @param int|null $max_w Image width. + * @param int|null $max_h Image height. + * @param bool|array $crop * @return true|WP_Error */ abstract public function resize( $max_w, $max_h, $crop = false ); @@ -121,9 +121,9 @@ abstract class WP_Image_Editor { * An array of image size arrays. Default sizes are 'small', 'medium', 'large'. * * @type array ...$0 { - * @type int $width Image width. - * @type int $height Image height. - * @type bool $crop Optional. Whether to crop the image. Default false. + * @type int $width Image width. + * @type int $height Image height. + * @type bool|array $crop Optional. Whether to crop the image. Default false. * } * } * @return array An array of resized images metadata by size.