Repository navigation
refactor: throw the framework RuntimeException when an image extension is missing - #10824
paulbalandan merged 14 commits into
Conversation
ResolvedHi there, @sgr1806-20! 👋 It looks like this pull request does not follow our template:
Please update the description to follow the template. The Hi there, @sgr1806-20! 👋 Thank you for sending this PR! We expect the following in all Pull Requests (PRs).
Important We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works. If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md |
michalsn
left a comment
There was a problem hiding this comment.
Thanks, but I would rather follow the path we have in the ImageMagickHandler: https://github.com/codeigniter4/CodeIgniter4/blob/4.8/system/Images/Handlers/ImageMagickHandler.php#L45
Thanks! Switched GDHandler to the same RuntimeException idiom as |
|
CI is green on this revision apart from the Psalm (8.3) job, which is PHP Static Analysis passes now that the stale baseline entry |
|
Please rebase. |
e5303ee to
0aeec13
Compare
Rebased onto the latest 4.8 (d4da78c). Diff unchanged. |
Add method for handling missing PHP extensions in ImageException.
Removed the forMissingExtension method from ImageException.
Removed the missing extension error message from language settings.
Removed test for missing GD extension.
PHPStan fails when an ignored error no longer occurs ("unmatched ignore")
…seline - GDHandler now throws CodeIgniter\Exceptions\RuntimeException - utils/phpstan-baseline regenerated with composer phpstan:baseline
3548b8d to
e39dec7
Compare
RuntimeException when an image extension is missing
|
Thank you, @sgr1806-20 , for your first contribution! |
Description
GDHandlercalled a factory that no longer exists:On 4.8 that method is undefined (ImageException doesn't define it, and
FrameworkException::forMissingExtension() was removed), so a host without
the GD extension fatalised with "Call to undefined method" instead of
throwing a catchable exception.
Rather than re-adding an exception factory, GDHandler now throws
CodeIgniter\Exceptions\RuntimeException, naming the handler and the missing
extension — the same shape ImageMagickHandler's guard already used. For
consistency, ImageMagickHandler now uses the framework exception class as
well, instead of the native \RuntimeException.
The PHPStan baseline entry that suppressed the undefined-method call
(utils/phpstan-baseline/staticMethod.notFound.neon) is obsolete, so the
baseline was regenerated with
composer phpstan:baseline.Verified by instantiating GDHandler on a PHP build without GD: before,
Error: Call to undefined method; after, RuntimeException: The
"...\GDHandler" handler requires the "gd" PHP extension.
Checklist: