Skip to content

Rework exception hierarchy onto marker interfaces (5.0, BREAKING)#39

Merged
turegjorup merged 3 commits into
developfrom
feature/exception-contract-migration
Jun 2, 2026
Merged

Rework exception hierarchy onto marker interfaces (5.0, BREAKING)#39
turegjorup merged 3 commits into
developfrom
feature/exception-contract-migration

Conversation

@turegjorup

Copy link
Copy Markdown
Contributor

What

PR 2 of 3 in the exception-contract effort. BREAKING — 5.0.

⚠️ Stacked on #38 (feature/phpstan-tooling). Review/merge that first; this PR's base auto-retargets to develop once #38 lands. The diff here is only the contract change.

Reworks the bundle's exception hierarchy to match the marker-interface contract introduced upstream in itk-dev/openid-connect 5.0:

  • New OpenIdConnectBundleExceptionInterface, extending the library's OpenIdConnectExceptionInterface. A consumer can catch every OIDC failure from both packages with one catch (OpenIdConnectExceptionInterface $e), or scope to the bundle with OpenIdConnectBundleExceptionInterface.
  • Concrete exceptions re-parented to the SPL type that fits the failure category (\RuntimeException, \InvalidArgumentException); they no longer extend ItkOpenIdConnectBundleException.
  • ItkOpenIdConnectBundleException kept as a @deprecated alias through 5.x (removed in 6.0).
  • @throws / catch types widened onto the marker in the authenticator, manager, controller and CLI helper; $previous chain preserved.
  • Bumped itk-dev/openid-connect to ^5.0.
  • tests/Exception/ExceptionHierarchyTest.php locks marker inheritance, SPL parents and cross-package catch.

BREAKING

catch (ItkOpenIdConnectBundleException $e) no longer matches any concrete thrown by the bundle. Migrate to catch (OpenIdConnectBundleExceptionInterface $e).

Verification

task analyze:php, task test (78 tests), task lint green against itk-dev/openid-connect 5.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

@codecov-commenter

codecov-commenter commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (88cd356) to head (22e9cdb).

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           
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@turegjorup turegjorup force-pushed the feature/phpstan-tooling branch from dbab86d to 1defa13 Compare June 2, 2026 09:38
@turegjorup turegjorup force-pushed the feature/exception-contract-migration branch from a4fcfac to 4b80930 Compare June 2, 2026 09:40
@turegjorup turegjorup force-pushed the feature/exception-contract-migration branch from 4b80930 to c88e2c9 Compare June 2, 2026 09:49
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>
@turegjorup turegjorup force-pushed the feature/exception-contract-migration branch from c88e2c9 to 1b4cc52 Compare June 2, 2026 09:51
Base automatically changed from feature/phpstan-tooling to develop June 2, 2026 09:55
turegjorup and others added 2 commits June 2, 2026 11:55
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>
@turegjorup turegjorup self-assigned this Jun 2, 2026
@turegjorup turegjorup merged commit 05b5375 into develop Jun 2, 2026
15 checks passed
@turegjorup turegjorup deleted the feature/exception-contract-migration branch June 2, 2026 10:08
@turegjorup turegjorup mentioned this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants