Repository navigation
Conversation
* fix/checker-manager-duplicate-checkers: fix(checker): deprecate a second checker of the same claim or header parameter
…ameter Since 4.3.0, building a claim or header checker manager with two different checkers of the same claim or header parameter triggers a deprecation, and the second checker replaces the first, which never runs. Both constructors now throw an InvalidArgumentException instead, naming the claim or header parameter and the classes of the two checkers. The same instance listed twice, for instance under two aliases of one service, is still accepted. In the bundle, the exception is thrown when the manager service is built, so an application with such a list fails on first use instead of running without one of its rules. Refs #756
This was referenced Nov 8, 2026
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.
Second part of #756, for 5.0.0. It depends on #778 (4.3.x): this branch merges the commit of #778, so that the merge-up of 4.3.x into 5.0.x stays free of conflicts. Draft until #778 is merged; if #778 changes during the review, this branch is rebuilt on top of it.
The change
With #778 (4.3.0), a claim or header checker manager given two different checkers of the same claim or header parameter triggers a deprecation and keeps the last one. In 5.0.0, both constructors throw an
InvalidArgumentExceptioninstead:jose.checkers.claims,jose.checkers.headerswith or withouttyp:, theheader_checkersof the loaders). An application with such a list fails on first use instead of running without one of its rules.This removes two of the
trigger_deprecation()calls that the "Done when" grep of #717 has to bring to zero.Verification
tests/Component/Checkerandtests/Bundle/JoseFramework/Functional/Checker: 104 tests green. Full suite on PHP 8.5: 2,265 tests green, with the same 4 skipped and 2 incomplete as the base.phpqa:8.4image.For the migration guide
A claim or header checker manager takes one checker per claim or header parameter. A list that gives a claim two checkers triggered a deprecation in 4.3. In 5.0 it throws when the manager is built. Combine the rules in one checker, for instance a checker of your own that calls
ExpirationTimeChecker::checkClaim()and then applies its own rule, or remove the redundant entry.