Skip to content

Commit 8a606ad

Browse files
authored
refactor: throw the framework RuntimeException when an image extension is missing (#10824)
1 parent 4f6ca9a commit 8a606ad

4 files changed

Lines changed: 7 additions & 12 deletions

File tree

‎system/Images/Handlers/GDHandler.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Images\Handlers;
1515

16+
use CodeIgniter\Exceptions\RuntimeException;
1617
use CodeIgniter\Images\Exceptions\ImageException;
1718
use Config\Images;
1819
use GdImage;
@@ -35,7 +36,10 @@ public function __construct($config = null)
3536
parent::__construct($config);
3637

3738
if (! extension_loaded('gd')) {
38-
throw ImageException::forMissingExtension('GD'); // @codeCoverageIgnore
39+
throw new RuntimeException(sprintf(
40+
'The "%s" handler requires the "gd" PHP extension.',
41+
static::class,
42+
));
3943
}
4044
}
4145

‎system/Images/Handlers/ImageMagickHandler.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace CodeIgniter\Images\Handlers;
1515

16+
use CodeIgniter\Exceptions\RuntimeException;
1617
use CodeIgniter\Images\Exceptions\ImageException;
1718
use Config\Images;
1819
use Imagick;
@@ -22,7 +23,6 @@
2223
use ImagickPixel;
2324
use ImagickPixelException;
2425
use Override;
25-
use RuntimeException;
2626

2727
/**
2828
* Image handler for Imagick extension.

‎utils/phpstan-baseline/loader.neon‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 38 errors
1+
# total 37 errors
22

33
includes:
44
- arguments.count.neon
@@ -8,4 +8,3 @@ includes:
88
- missingType.callable.neon
99
- property.defaultValue.neon
1010
- property.phpDocType.neon
11-
- staticMethod.notFound.neon

‎utils/phpstan-baseline/staticMethod.notFound.neon‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)