Rework exception hierarchy onto marker interfaces (5.0, BREAKING)#39
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #39 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 62 62
===========================================
Files 9 9
Lines 280 280
===========================================
Hits 280 280
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dbab86d to
1defa13
Compare
a4fcfac to
4b80930
Compare
4b80930 to
c88e2c9
Compare
Every exception thrown from a public method now implements OpenIdConnectBundleExceptionInterface, which extends the upstream library marker OpenIdConnectExceptionInterface. Concrete exceptions extend the SPL type that best fits the failure category and no longer extend the abstract ItkOpenIdConnectBundleException (kept as a deprecated alias for 5.x). A consumer can now catch every OIDC failure from both packages with a single catch (OpenIdConnectExceptionInterface), or scope to the bundle with OpenIdConnectBundleExceptionInterface. - Bump itk-dev/openid-connect to ^5.0 for the matching upstream contract. - Widen @throws / catch types in the authenticator, manager, controller and CLI helper onto the marker interface; preserve the $previous chain. - Add ExceptionHierarchyTest locking marker inheritance, SPL parents and cross-package catch. BREAKING: catch (ItkOpenIdConnectBundleException) no longer matches any concrete thrown by the bundle. Catch OpenIdConnectBundleExceptionInterface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c88e2c9 to
1b4cc52
Compare
CLAUDE.md is a local-only file (gitignored), so a committed test should not point at it. Reference the committed docs/adr/001-marker-interface-exception-hierarchy.md instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PR 2 of 3 in the exception-contract effort. BREAKING — 5.0.
Reworks the bundle's exception hierarchy to match the marker-interface contract introduced upstream in
itk-dev/openid-connect5.0:OpenIdConnectBundleExceptionInterface, extending the library'sOpenIdConnectExceptionInterface. A consumer can catch every OIDC failure from both packages with onecatch (OpenIdConnectExceptionInterface $e), or scope to the bundle withOpenIdConnectBundleExceptionInterface.\RuntimeException,\InvalidArgumentException); they no longer extendItkOpenIdConnectBundleException.ItkOpenIdConnectBundleExceptionkept as a@deprecatedalias through 5.x (removed in 6.0).@throws/ catch types widened onto the marker in the authenticator, manager, controller and CLI helper;$previouschain preserved.itk-dev/openid-connectto^5.0.tests/Exception/ExceptionHierarchyTest.phplocks marker inheritance, SPL parents and cross-package catch.BREAKING
catch (ItkOpenIdConnectBundleException $e)no longer matches any concrete thrown by the bundle. Migrate tocatch (OpenIdConnectBundleExceptionInterface $e).Verification
task analyze:php,task test(78 tests),task lintgreen againstitk-dev/openid-connect5.0.0.Notes
The controller/authenticator HTTP-exception carve-outs are documented in PHPDoc; the contract-locking PHPStan rules follow in PR 3.
🤖 Generated with Claude Code