diff --git a/src/BlurHash.php b/src/BlurHash.php index aab8461..2bd8f61 100644 --- a/src/BlurHash.php +++ b/src/BlurHash.php @@ -311,7 +311,7 @@ public function __construct( 'php-vips' => VipsDriver::class, ]; - if (! isset($drivers[$loader])) { + if (! isset($drivers[$loader])) { // @phpstan-ignore isset.offset throw new DriverNotFoundException( sprintf('"%s" is not a valid driver.', $loader), ); diff --git a/src/Drivers/GdDriver.php b/src/Drivers/GdDriver.php index c11cac4..484ee3d 100644 --- a/src/Drivers/GdDriver.php +++ b/src/Drivers/GdDriver.php @@ -92,7 +92,7 @@ public function read(string $path): GdImage public function resize(object $origin): GdImage { if (imagepalettetotruecolor($origin) === false) { - throw new UnableToConvertColorException(); + throw new UnableToConvertColorException; } [$originWidth, $originHeight] = $this->size($origin); @@ -162,7 +162,7 @@ public function resize(object $origin): GdImage */ public function size(object $image): array { - return [ // @phpstan-ignore-line + return [ imagesx($image), imagesy($image), ]; @@ -198,7 +198,7 @@ public function create(int $width, int $height): static $image = imagecreatetruecolor($width, $height); if ($image === false) { - throw new UnableToCreateImageException(); + throw new UnableToCreateImageException; } $this->image = $image; @@ -216,7 +216,7 @@ public function pixel(int $x, int $y, array $color): bool $draw = imagecolorallocate($this->image, ...$color); if ($draw === false) { - throw new UnableToSetPixelException(); + throw new UnableToSetPixelException; } return imagesetpixel($this->image, $x, $y, $draw); diff --git a/src/Drivers/ImagickDriver.php b/src/Drivers/ImagickDriver.php index 0f2cea9..b9025c2 100644 --- a/src/Drivers/ImagickDriver.php +++ b/src/Drivers/ImagickDriver.php @@ -119,7 +119,7 @@ public function color(object $image, int $x, int $y): array|false */ public function create(int $width, int $height): static { - $this->image = new Imagick(); + $this->image = new Imagick; try { $this->image->newImage( @@ -128,7 +128,7 @@ public function create(int $width, int $height): static new ImagickPixel('transparent'), ); } catch (ImagickException) { - throw new UnableToCreateImageException(); + throw new UnableToCreateImageException; } return $this; @@ -144,19 +144,19 @@ public function pixel(int $x, int $y, array $color): bool try { $rga = sprintf('rgb(%s,%s,%s)', ...$color); - $draw = new ImagickDraw(); + $draw = new ImagickDraw; $draw->setFillColor(new ImagickPixel($rga)); $draw->point($x, $y); if ($this->image->drawImage($draw) === false) { - throw new UnableToSetPixelException(); + throw new UnableToSetPixelException; } return true; } catch (ImagickException|ImagickDrawException|ImagickPixelException) { - throw new UnableToSetPixelException(); + throw new UnableToSetPixelException; } } } diff --git a/src/Drivers/VipsDriver.php b/src/Drivers/VipsDriver.php index ba7c73f..a9e95ac 100644 --- a/src/Drivers/VipsDriver.php +++ b/src/Drivers/VipsDriver.php @@ -141,7 +141,7 @@ public function create(int $width, int $height): static $this->memory = $this->image->writeToMemory(); } catch (Exception) { - throw new UnableToCreateImageException(); + throw new UnableToCreateImageException; } return $this; @@ -171,7 +171,7 @@ public function pixel(int $x, int $y, array $color): bool $this->image->format, ); } catch (Exception) { - throw new UnableToSetPixelException(); + throw new UnableToSetPixelException; } return true; diff --git a/tests/BlurHashTest.php b/tests/BlurHashTest.php index 867dda2..31d3006 100644 --- a/tests/BlurHashTest.php +++ b/tests/BlurHashTest.php @@ -23,7 +23,7 @@ protected function setUp(): void { parent::setUp(); - Config::setLogger(new DebugLogger()); + Config::setLogger(new DebugLogger); } protected function file(string $name): string