diff --git a/system/Images/Handlers/GDHandler.php b/system/Images/Handlers/GDHandler.php index 705d1b5d4156..b7497b2e8255 100644 --- a/system/Images/Handlers/GDHandler.php +++ b/system/Images/Handlers/GDHandler.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Images\Handlers; +use CodeIgniter\Exceptions\RuntimeException; use CodeIgniter\Images\Exceptions\ImageException; use Config\Images; use GdImage; @@ -35,7 +36,10 @@ public function __construct($config = null) parent::__construct($config); if (! extension_loaded('gd')) { - throw ImageException::forMissingExtension('GD'); // @codeCoverageIgnore + throw new RuntimeException(sprintf( + 'The "%s" handler requires the "gd" PHP extension.', + static::class, + )); } } diff --git a/system/Images/Handlers/ImageMagickHandler.php b/system/Images/Handlers/ImageMagickHandler.php index 5dc24fe358f0..523f75534e74 100644 --- a/system/Images/Handlers/ImageMagickHandler.php +++ b/system/Images/Handlers/ImageMagickHandler.php @@ -13,6 +13,7 @@ namespace CodeIgniter\Images\Handlers; +use CodeIgniter\Exceptions\RuntimeException; use CodeIgniter\Images\Exceptions\ImageException; use Config\Images; use Imagick; @@ -22,7 +23,6 @@ use ImagickPixel; use ImagickPixelException; use Override; -use RuntimeException; /** * Image handler for Imagick extension. diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 9a9653cc3c2e..c3f82af9dbf4 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 38 errors +# total 37 errors includes: - arguments.count.neon @@ -8,4 +8,3 @@ includes: - missingType.callable.neon - property.defaultValue.neon - property.phpDocType.neon - - staticMethod.notFound.neon diff --git a/utils/phpstan-baseline/staticMethod.notFound.neon b/utils/phpstan-baseline/staticMethod.notFound.neon deleted file mode 100644 index ee77d25a47cc..000000000000 --- a/utils/phpstan-baseline/staticMethod.notFound.neon +++ /dev/null @@ -1,8 +0,0 @@ -# total 1 error - -parameters: - ignoreErrors: - - - message: '#^Call to an undefined static method CodeIgniter\\Images\\Exceptions\\ImageException\:\:forMissingExtension\(\)\.$#' - count: 1 - path: ../../system/Images/Handlers/GDHandler.php