From 622a0f947eab847e4e10e82f61a8b6c74753d112 Mon Sep 17 00:00:00 2001 From: LolGleb Date: Wed, 30 Aug 2023 15:14:32 +0200 Subject: [PATCH] [phpstorm-stubs] Attempt to fix methods signature according to tests failures. --- gd/gd.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/gd/gd.php b/gd/gd.php index 81cfc892e..b2761404b 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1028,9 +1028,9 @@ function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters * Output a WebP image to browser or file * @link https://php.net/manual/en/function.imagewebp.php * @param resource|GdImage $image - * @param string $to [optional]

- * The path to save the file to. If not set or null, the raw image stream - * will be outputted directly. + * @param resource|string|null $file [optional]

+ * The path or an open stream resource (which is automatically closed after this function returns) + * to save the file to. If not set or null, the raw image stream will be output directly. *

* @param int $quality [optional]

* quality ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). @@ -1038,7 +1038,7 @@ function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters * @return bool true on success or false on failure. * @since 5.4 */ -function imagewebp($image, $to = null, $quality = -1): bool {} +function imagewebp(GdImage $image, $file = null, int $quality = -1): bool {} /** * Output image to browser or file @@ -1071,7 +1071,7 @@ function imagegif(GdImage $image, $file = null): bool {} *

* @return bool true on success or false on failure. */ -function imagejpeg($image, $file = null, $quality = -1): bool {} +function imagejpeg(GdImage $image, $file = null, int $quality = -1): bool {} /** * Output image to browser or file @@ -1569,9 +1569,10 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * search for files that do not begin with a leading '/' by appending * '.ttf' to the filename and searching along a library-defined font path. *

- * @param string $text

+ * @param string $string

* The string to be measured. *

+ * @param array $options [optional] * @return array|false imagettfbbox returns an array with 8 * elements representing four points making the bounding box of the * text on success and false on error. @@ -1618,7 +1619,7 @@ function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int * corner seeing the text horizontally. */ #[Pure] -function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) {} +function imagettfbbox(float $size, float $angle, string $font_filename, string $string, #[PhpStormStubsElementAvailable(from: '8.0')] $options = []): array|false {} /** * Write text to the image using TrueType fonts @@ -1703,6 +1704,7 @@ function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) * If a character is used in the string which is not supported by the * font, a hollow rectangle will replace the character. *

+ * @param array $options [optional] * @return array|false an array with 8 elements representing four points making the * bounding box of the text. The order of the points is lower left, lower * right, upper right, upper left. The points are relative to the text @@ -1710,7 +1712,7 @@ function imagettfbbox($size, $angle, $font_filename, $text, array $options = []) * corner when you see the text horizontally. * Returns false on error. */ -function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {} +function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, #[PhpStormStubsElementAvailable(from: '8.0')] array $options = []): array|false {} /** * Give the bounding box of a text using fonts via freetype2 @@ -1790,7 +1792,7 @@ function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, * Returns false on error. */ #[Pure] -function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} +function imageftbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array|false {} /** * Write text to the image using fonts using FreeType 2 @@ -1855,7 +1857,7 @@ function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} * Note: * open_basedir does not apply to font_filename. *

- * @param string $string

+ * @param string $text

* Text to be inserted into image. *

* @param array $options [optional]

@@ -1908,7 +1910,7 @@ function imageftbbox($size, $angle, $font_filename, $string, $options = []) {} * * Returns false on error. */ -function imagefttext($image, $size, $angle, $x, $y, $color, $font_filename, $string, $options = []) {} +function imagefttext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {} /** * Load a PostScript Type 1 font from file