From 3e87be6a63e16a22a26c40b19bd5f60a51fa940e Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 28 Feb 2024 17:30:25 +0100 Subject: [PATCH] Add decoder and encoder thrown exception --- src/Drivers/AbstractInputHandler.php | 1 + src/Drivers/Gd/Decoders/AbstractDecoder.php | 2 + src/Drivers/Gd/Driver.php | 4 ++ src/Drivers/Gd/Encoders/GifEncoder.php | 4 ++ src/Drivers/Gd/Modifiers/FillModifier.php | 4 ++ src/Drivers/Imagick/Driver.php | 4 ++ src/Exceptions/AnimationException.php | 2 +- src/Exceptions/ColorException.php | 2 +- src/Exceptions/DecoderException.php | 2 +- src/Exceptions/EncoderException.php | 2 +- src/Exceptions/FontException.php | 2 +- src/Exceptions/GeometryException.php | 2 +- src/Exceptions/InputException.php | 2 +- src/Exceptions/NotSupportedException.php | 2 +- src/Exceptions/NotWritableException.php | 2 +- src/Image.php | 5 ++ src/ImageManager.php | 2 + src/Interfaces/DecoderInterface.php | 3 ++ src/Interfaces/DriverInterface.php | 3 ++ src/Interfaces/EncoderInterface.php | 3 ++ src/Interfaces/ImageInterface.php | 58 +++++++++++++++++++++ src/Interfaces/InputHandlerInterface.php | 3 ++ src/Interfaces/ModifierInterface.php | 3 ++ 23 files changed, 108 insertions(+), 9 deletions(-) diff --git a/src/Drivers/AbstractInputHandler.php b/src/Drivers/AbstractInputHandler.php index 88d77c4b..d33816fa 100644 --- a/src/Drivers/AbstractInputHandler.php +++ b/src/Drivers/AbstractInputHandler.php @@ -32,6 +32,7 @@ abstract class AbstractInputHandler implements InputHandlerInterface * Stack the decoder array into a nested decoder object * * @return AbstractDecoder + * @throws DecoderException */ protected function chain(): AbstractDecoder { diff --git a/src/Drivers/Gd/Decoders/AbstractDecoder.php b/src/Drivers/Gd/Decoders/AbstractDecoder.php index d75996b2..2bf1dfe1 100644 --- a/src/Drivers/Gd/Decoders/AbstractDecoder.php +++ b/src/Drivers/Gd/Decoders/AbstractDecoder.php @@ -14,6 +14,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder * * @param string $filepath * @return string + * @throws DecoderException */ protected function getMediaTypeByFilePath(string $filepath): string { @@ -35,6 +36,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder * * @param string $data * @return string + * @throws DecoderException */ protected function getMediaTypeByBinary(string $data): string { diff --git a/src/Drivers/Gd/Driver.php b/src/Drivers/Gd/Driver.php index f454265e..1ad13705 100644 --- a/src/Drivers/Gd/Driver.php +++ b/src/Drivers/Gd/Driver.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Intervention\Image\Drivers\Gd; use Intervention\Image\Drivers\AbstractDriver; +use Intervention\Image\Exceptions\DecoderException; use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Image; use Intervention\Image\Interfaces\ColorInterface; @@ -79,6 +80,9 @@ class Driver extends AbstractDriver ) { } + /** + * @throws DecoderException + */ public function add($source, float $delay = 1): self { $this->core->add( diff --git a/src/Drivers/Gd/Encoders/GifEncoder.php b/src/Drivers/Gd/Encoders/GifEncoder.php index 83e038e1..8771ed65 100644 --- a/src/Drivers/Gd/Encoders/GifEncoder.php +++ b/src/Drivers/Gd/Encoders/GifEncoder.php @@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Gd\Encoders; use Intervention\Gif\Builder as GifBuilder; use Intervention\Image\Drivers\DriverSpecializedEncoder; use Intervention\Image\EncodedImage; +use Intervention\Image\Exceptions\EncoderException; use Intervention\Image\Interfaces\ImageInterface; class GifEncoder extends DriverSpecializedEncoder @@ -25,6 +26,9 @@ class GifEncoder extends DriverSpecializedEncoder return new EncodedImage($data, 'image/gif'); } + /** + * @throws EncoderException + */ protected function encodeAnimated(ImageInterface $image): EncodedImage { $builder = GifBuilder::canvas( diff --git a/src/Drivers/Gd/Modifiers/FillModifier.php b/src/Drivers/Gd/Modifiers/FillModifier.php index 00265248..976ab75e 100644 --- a/src/Drivers/Gd/Modifiers/FillModifier.php +++ b/src/Drivers/Gd/Modifiers/FillModifier.php @@ -6,6 +6,7 @@ namespace Intervention\Image\Drivers\Gd\Modifiers; use Intervention\Image\Drivers\DriverSpecialized; use Intervention\Image\Drivers\Gd\Frame; +use Intervention\Image\Exceptions\DecoderException; use Intervention\Image\Interfaces\ImageInterface; use Intervention\Image\Geometry\Point; use Intervention\Image\Interfaces\ModifierInterface; @@ -32,6 +33,9 @@ class FillModifier extends DriverSpecialized implements ModifierInterface return $image; } + /** + * @throws DecoderException + */ private function color(ImageInterface $image): int { return $this->driver()->colorProcessor($image->colorspace())->colorToNative( diff --git a/src/Drivers/Imagick/Driver.php b/src/Drivers/Imagick/Driver.php index 531bba39..cc55bbbc 100644 --- a/src/Drivers/Imagick/Driver.php +++ b/src/Drivers/Imagick/Driver.php @@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Imagick; use Imagick; use ImagickPixel; use Intervention\Image\Drivers\AbstractDriver; +use Intervention\Image\Exceptions\DecoderException; use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Image; use Intervention\Image\Interfaces\ColorInterface; @@ -81,6 +82,9 @@ class Driver extends AbstractDriver ) { } + /** + * @throws DecoderException + */ public function add($source, float $delay = 1): self { $native = $this->driver->handleInput($source)->core()->native(); diff --git a/src/Exceptions/AnimationException.php b/src/Exceptions/AnimationException.php index f2d4421b..c34f08a1 100644 --- a/src/Exceptions/AnimationException.php +++ b/src/Exceptions/AnimationException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class AnimationException extends \RuntimeException +class AnimationException extends RuntimeException { } diff --git a/src/Exceptions/ColorException.php b/src/Exceptions/ColorException.php index 4d3e1889..f7da5722 100644 --- a/src/Exceptions/ColorException.php +++ b/src/Exceptions/ColorException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class ColorException extends \RuntimeException +class ColorException extends RuntimeException { } diff --git a/src/Exceptions/DecoderException.php b/src/Exceptions/DecoderException.php index f9bc9d5c..96d7e294 100644 --- a/src/Exceptions/DecoderException.php +++ b/src/Exceptions/DecoderException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class DecoderException extends \RuntimeException +class DecoderException extends RuntimeException { } diff --git a/src/Exceptions/EncoderException.php b/src/Exceptions/EncoderException.php index a548e9ab..d0900129 100644 --- a/src/Exceptions/EncoderException.php +++ b/src/Exceptions/EncoderException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class EncoderException extends \RuntimeException +class EncoderException extends RuntimeException { } diff --git a/src/Exceptions/FontException.php b/src/Exceptions/FontException.php index ed57aeb1..581be81b 100644 --- a/src/Exceptions/FontException.php +++ b/src/Exceptions/FontException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class FontException extends \RuntimeException +class FontException extends RuntimeException { } diff --git a/src/Exceptions/GeometryException.php b/src/Exceptions/GeometryException.php index b161ad2d..f017949b 100644 --- a/src/Exceptions/GeometryException.php +++ b/src/Exceptions/GeometryException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class GeometryException extends \RuntimeException +class GeometryException extends RuntimeException { } diff --git a/src/Exceptions/InputException.php b/src/Exceptions/InputException.php index 322cee33..b68678e4 100644 --- a/src/Exceptions/InputException.php +++ b/src/Exceptions/InputException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class InputException extends \RuntimeException +class InputException extends RuntimeException { } diff --git a/src/Exceptions/NotSupportedException.php b/src/Exceptions/NotSupportedException.php index a7018870..bbf15761 100644 --- a/src/Exceptions/NotSupportedException.php +++ b/src/Exceptions/NotSupportedException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class NotSupportedException extends \RuntimeException +class NotSupportedException extends RuntimeException { } diff --git a/src/Exceptions/NotWritableException.php b/src/Exceptions/NotWritableException.php index 54048e62..a292ea00 100644 --- a/src/Exceptions/NotWritableException.php +++ b/src/Exceptions/NotWritableException.php @@ -4,6 +4,6 @@ declare(strict_types=1); namespace Intervention\Image\Exceptions; -class NotWritableException extends \RuntimeException +class NotWritableException extends RuntimeException { } diff --git a/src/Image.php b/src/Image.php index 216e44f0..8f536af0 100644 --- a/src/Image.php +++ b/src/Image.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Intervention\Image; +use Intervention\Image\Exceptions\RuntimeException; use Traversable; use Intervention\Image\Analyzers\ColorspaceAnalyzer; use Intervention\Image\Analyzers\HeightAnalyzer; @@ -892,6 +893,7 @@ final class Image implements ImageInterface * * @param mixed $options * @return EncodedImageInterface + * @throws RuntimeException */ public function toJpg(mixed ...$options): EncodedImageInterface { @@ -913,6 +915,7 @@ final class Image implements ImageInterface * * @param mixed $options * @return EncodedImageInterface + * @throws RuntimeException */ public function toJp2(mixed ...$options): EncodedImageInterface { @@ -963,6 +966,7 @@ final class Image implements ImageInterface * Alias if self::toBitmap() * * @return EncodedImageInterface + * @throws RuntimeException */ public function toBmp(mixed ...$options): EncodedImageInterface { @@ -994,6 +998,7 @@ final class Image implements ImageInterface * * @param mixed $options * @return EncodedImageInterface + * @throws RuntimeException */ public function toTif(mixed ...$options): EncodedImageInterface { diff --git a/src/ImageManager.php b/src/ImageManager.php index aa6ebbf4..300147fe 100644 --- a/src/ImageManager.php +++ b/src/ImageManager.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Intervention\Image; +use Intervention\Image\Exceptions\DecoderException; use Intervention\Image\Interfaces\DriverInterface; use Intervention\Image\Interfaces\ImageInterface; use Intervention\Image\Drivers\Gd\Driver as GdDriver; @@ -88,6 +89,7 @@ final class ImageManager * @param mixed $input * @param string|array|DecoderInterface $decoders * @return ImageInterface + * @throws DecoderException */ public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface { diff --git a/src/Interfaces/DecoderInterface.php b/src/Interfaces/DecoderInterface.php index 26d9b1be..b7bf3f25 100644 --- a/src/Interfaces/DecoderInterface.php +++ b/src/Interfaces/DecoderInterface.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Interfaces; +use Intervention\Image\Exceptions\DecoderException; + interface DecoderInterface { /** @@ -11,6 +13,7 @@ interface DecoderInterface * * @param mixed $input * @return ImageInterface|ColorInterface + * @throws DecoderException */ public function decode(mixed $input): ImageInterface|ColorInterface; } diff --git a/src/Interfaces/DriverInterface.php b/src/Interfaces/DriverInterface.php index a3ac73a9..cb1830ce 100644 --- a/src/Interfaces/DriverInterface.php +++ b/src/Interfaces/DriverInterface.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Interfaces; +use Intervention\Image\Exceptions\DecoderException; + interface DriverInterface { /** @@ -52,6 +54,7 @@ interface DriverInterface * @param mixed $input * @param array $decoders * @return ImageInterface|ColorInterface + * @throws DecoderException */ public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface; diff --git a/src/Interfaces/EncoderInterface.php b/src/Interfaces/EncoderInterface.php index 8f3cdbf4..8f655d6e 100644 --- a/src/Interfaces/EncoderInterface.php +++ b/src/Interfaces/EncoderInterface.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Interfaces; +use Intervention\Image\Exceptions\EncoderException; + interface EncoderInterface { /** @@ -11,6 +13,7 @@ interface EncoderInterface * * @param ImageInterface $image * @return EncodedImageInterface + * @throws EncoderException */ public function encode(ImageInterface $image): EncodedImageInterface; } diff --git a/src/Interfaces/ImageInterface.php b/src/Interfaces/ImageInterface.php index d0b7bf2d..b79f0b9b 100644 --- a/src/Interfaces/ImageInterface.php +++ b/src/Interfaces/ImageInterface.php @@ -6,6 +6,8 @@ namespace Intervention\Image\Interfaces; use Countable; use Intervention\Image\Encoders\AutoEncoder; +use Intervention\Image\Exceptions\DecoderException; +use Intervention\Image\Exceptions\EncoderException; use Intervention\Image\Origin; use IteratorAggregate; @@ -66,6 +68,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param EncoderInterface $encoder * @return EncodedImageInterface + * @throws EncoderException */ public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface; @@ -75,6 +78,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param null|string $path * @return ImageInterface + * @throws EncoderException */ public function save(?string $path = null, ...$options): self; @@ -83,6 +87,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param ModifierInterface $modifier * @return ImageInterface + * @throws DecoderException */ public function modify(ModifierInterface $modifier): self; @@ -111,6 +116,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int|string $position * @return ImageInterface + * @throws DecoderException */ public function removeAnimation(int|string $position = 0): self; @@ -120,6 +126,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $offset * @param null|int $length * @return ImageInterface + * @throws DecoderException */ public function sliceAnimation(int $offset = 0, ?int $length = null): self; @@ -166,6 +173,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param float $x * @param float $y * @return ImageInterface + * @throws DecoderException */ public function setResolution(float $x, float $y): self; @@ -181,6 +189,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param string|ColorspaceInterface $colorspace * @return ImageInterface + * @throws DecoderException */ public function setColorspace(string|ColorspaceInterface $colorspace): self; @@ -217,6 +226,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $color * @return ImageInterface + * @throws DecoderException */ public function setBlendingColor(mixed $color): self; @@ -225,6 +235,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $color * @return ImageInterface + * @throws DecoderException */ public function blendTransparency(mixed $color = null): self; @@ -240,6 +251,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param ProfileInterface $profile * @return ImageInterface + * @throws DecoderException */ public function setProfile(ProfileInterface $profile): self; @@ -247,6 +259,7 @@ interface ImageInterface extends IteratorAggregate, Countable * Remove ICC color profile from the current image * * @return ImageInterface + * @throws DecoderException */ public function removeProfile(): self; @@ -256,6 +269,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $limit * @param mixed $background * @return ImageInterface + * @throws DecoderException */ public function reduceColors(int $limit, mixed $background = 'transparent'): self; @@ -264,6 +278,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int $amount * @return ImageInterface + * @throws DecoderException */ public function sharpen(int $amount = 10): self; @@ -271,6 +286,7 @@ interface ImageInterface extends IteratorAggregate, Countable * Turn image into a greyscale version * * @return ImageInterface + * @throws DecoderException */ public function greyscale(): self; @@ -279,6 +295,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int $level * @return ImageInterface + * @throws DecoderException */ public function brightness(int $level): self; @@ -287,6 +304,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int $level * @return ImageInterface + * @throws DecoderException */ public function contrast(int $level): self; @@ -295,6 +313,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param float $gamma * @return ImageInterface + * @throws DecoderException */ public function gamma(float $gamma): self; @@ -305,6 +324,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $green * @param int $blue * @return ImageInterface + * @throws DecoderException */ public function colorize(int $red = 0, int $green = 0, int $blue = 0): self; @@ -312,6 +332,7 @@ interface ImageInterface extends IteratorAggregate, Countable * Mirror the current image horizontally * * @return ImageInterface + * @throws DecoderException */ public function flip(): self; @@ -319,6 +340,7 @@ interface ImageInterface extends IteratorAggregate, Countable * Mirror the current image vertically * * @return ImageInterface + * @throws DecoderException */ public function flop(): self; @@ -327,6 +349,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int $amount * @return ImageInterface + * @throws DecoderException */ public function blur(int $amount = 5): self; @@ -334,6 +357,7 @@ interface ImageInterface extends IteratorAggregate, Countable * Invert the colors of the current image * * @return ImageInterface + * @throws DecoderException */ public function invert(): self; @@ -342,6 +366,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param int $size * @return ImageInterface + * @throws DecoderException */ public function pixelate(int $size): self; @@ -351,6 +376,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param float $angle * @param string $background * @return ImageInterface + * @throws DecoderException */ public function rotate(float $angle, mixed $background = 'ffffff'): self; @@ -362,6 +388,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $y * @param callable|FontInterface $font * @return ImageInterface + * @throws DecoderException */ public function text(string $text, int $x, int $y, callable|FontInterface $font): self; @@ -371,6 +398,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|int $width * @param null|int $height * @return ImageInterface + * @throws DecoderException */ public function resize(?int $width = null, ?int $height = null): self; @@ -380,6 +408,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|int $width * @param null|int $height * @return ImageInterface + * @throws DecoderException */ public function resizeDown(?int $width = null, ?int $height = null): self; @@ -389,6 +418,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|int $width * @param null|int $height * @return ImageInterface + * @throws DecoderException */ public function scale(?int $width = null, ?int $height = null): self; @@ -399,6 +429,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|int $width * @param null|int $height * @return ImageInterface + * @throws DecoderException */ public function scaleDown(?int $width = null, ?int $height = null): self; @@ -411,6 +442,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $height * @param string $position * @return ImageInterface + * @throws DecoderException */ public function cover(int $width, int $height, string $position = 'center'): self; @@ -421,6 +453,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $height * @param string $position * @return ImageInterface + * @throws DecoderException */ public function coverDown(int $width, int $height, string $position = 'center'): self; @@ -435,6 +468,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param string $position * @param mixed $background * @return ImageInterface + * @throws DecoderException */ public function resizeCanvas( ?int $width = null, @@ -453,6 +487,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param string $position * @param mixed $background * @return ImageInterface + * @throws DecoderException */ public function resizeCanvasRelative( ?int $width = null, @@ -475,6 +510,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param string $background * @param string $position * @return ImageInterface + * @throws DecoderException */ public function pad( int $width, @@ -492,6 +528,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param string $background * @param string $position * @return ImageInterface + * @throws DecoderException */ public function contain( int $width, @@ -512,6 +549,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param mixed $background * @param string $position * @return ImageInterface + * @throws DecoderException */ public function crop( int $width, @@ -531,6 +569,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $offset_y * @param int $opacity * @return ImageInterface + * @throws DecoderException */ public function place( mixed $element, @@ -554,6 +593,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param null|int $x * @param null|int $y * @return ImageInterface + * @throws DecoderException */ public function fill(mixed $color, ?int $x = null, ?int $y = null): self; @@ -564,6 +604,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $y * @param mixed $color * @return ImageInterface + * @throws DecoderException */ public function drawPixel(int $x, int $y, mixed $color): self; @@ -574,6 +615,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $y * @param callable $init * @return ImageInterface + * @throws DecoderException */ public function drawRectangle(int $x, int $y, callable $init): self; @@ -584,6 +626,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $y * @param callable $init * @return ImageInterface + * @throws DecoderException */ public function drawEllipse(int $x, int $y, callable $init): self; @@ -594,6 +637,7 @@ interface ImageInterface extends IteratorAggregate, Countable * @param int $y * @param callable $init * @return ImageInterface + * @throws DecoderException */ public function drawCircle(int $x, int $y, callable $init): self; @@ -602,6 +646,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param callable $init * @return ImageInterface + * @throws DecoderException */ public function drawPolygon(callable $init): self; @@ -610,6 +655,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param callable $init * @return ImageInterface + * @throws DecoderException */ public function drawLine(callable $init): self; @@ -619,6 +665,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param null|string $type * @return EncodedImageInterface + * @throws EncoderException */ public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface; @@ -629,6 +676,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param null|string $extension * @return EncodedImageInterface + * @throws EncoderException */ public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface; @@ -639,6 +687,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param null|string $path * @return EncodedImageInterface + * @throws EncoderException */ public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface; @@ -647,6 +696,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toJpeg(mixed ...$options): EncodedImageInterface; @@ -656,6 +706,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toJpeg2000(mixed ...$options): EncodedImageInterface; @@ -664,6 +715,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toWebp(mixed ...$options): EncodedImageInterface; @@ -672,6 +724,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toPng(mixed ...$options): EncodedImageInterface; @@ -680,6 +733,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toGif(mixed ...$options): EncodedImageInterface; @@ -688,6 +742,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toBitmap(mixed ...$options): EncodedImageInterface; @@ -696,6 +751,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toAvif(mixed ...$options): EncodedImageInterface; @@ -704,6 +760,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toTiff(mixed ...$options): EncodedImageInterface; @@ -712,6 +769,7 @@ interface ImageInterface extends IteratorAggregate, Countable * * @param mixed $options * @return EncodedImageInterface + * @throws EncoderException */ public function toHeic(mixed ...$options): EncodedImageInterface; } diff --git a/src/Interfaces/InputHandlerInterface.php b/src/Interfaces/InputHandlerInterface.php index 864b5728..d19a1c90 100644 --- a/src/Interfaces/InputHandlerInterface.php +++ b/src/Interfaces/InputHandlerInterface.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Interfaces; +use Intervention\Image\Exceptions\DecoderException; + interface InputHandlerInterface { /** @@ -11,6 +13,7 @@ interface InputHandlerInterface * * @param mixed $input * @return ImageInterface|ColorInterface + * @throws DecoderException */ public function handle($input): ImageInterface|ColorInterface; } diff --git a/src/Interfaces/ModifierInterface.php b/src/Interfaces/ModifierInterface.php index 2fb0f8b4..3ad4d6bb 100644 --- a/src/Interfaces/ModifierInterface.php +++ b/src/Interfaces/ModifierInterface.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Intervention\Image\Interfaces; +use Intervention\Image\Exceptions\DecoderException; + interface ModifierInterface { /** @@ -11,6 +13,7 @@ interface ModifierInterface * * @param ImageInterface $image * @return ImageInterface + * @throws DecoderException */ public function apply(ImageInterface $image): ImageInterface; }