From b319f0d6ede8dbc469117def2691e91b9376c3b7 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Wed, 28 Oct 2026 00:19:37 +0800 Subject: [PATCH] refactor: fix `null` checks that are always `false` --- system/Images/Handlers/ImageMagickHandler.php | 7 ++----- system/Images/Image.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/system/Images/Handlers/ImageMagickHandler.php b/system/Images/Handlers/ImageMagickHandler.php index 3215c84f1ab3..4a92ddf7900b 100644 --- a/system/Images/Handlers/ImageMagickHandler.php +++ b/system/Images/Handlers/ImageMagickHandler.php @@ -318,13 +318,10 @@ public function save(?string $target = null, int $quality = 90): bool } $this->ensureResource(); - $this->resource->setImageCompressionQuality($quality); - if ($target !== null) { - $extension = pathinfo($target, PATHINFO_EXTENSION); - $this->resource->setImageFormat($extension); - } + $extension = pathinfo($target, PATHINFO_EXTENSION); + $this->resource->setImageFormat($extension); try { $result = $this->resource->writeImage($target); diff --git a/system/Images/Image.php b/system/Images/Image.php index 77eecf8e7b8e..9a396241c158 100644 --- a/system/Images/Image.php +++ b/system/Images/Image.php @@ -73,7 +73,7 @@ public function copy(string $targetPath, ?string $targetName = null, int $perms $targetName ??= $this->getFilename(); - if ($targetName === null || $targetName === '') { + if ($targetName === '') { throw ImageException::forInvalidFile($targetName); }