fix(state): use exception message for user-facing violation when available#7894
Open
vincentchalamon wants to merge 5 commits into4.3from
Open
fix(state): use exception message for user-facing violation when available#7894vincentchalamon wants to merge 5 commits into4.3from
vincentchalamon wants to merge 5 commits into4.3from
Conversation
…lable When a NotNormalizableValueException has canUseMessageForUser() = true, use its message directly as the constraint violation message instead of the generic Type constraint message. This fixes issues with Symfony 8.x where expectedTypes can be null/empty, producing broken messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…expectedTypes Simulates the behavior from symfony/serializer PR #62574 where an invalid enum value produces an exception with expectedTypes=null and a user-friendly message listing valid values. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ymfony compat - Sort ValidationException import alphabetically in DeserializeProviderTest - Update ValidationTest to expect exception message when canUseMessageForUser() is true - Use positional params for NotNormalizableValueException ctor (lowest Symfony compat) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… violations These violations have canUseMessageForUser()=true, so the new behavior uses the exception message directly instead of the generic type message. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The extended NotNormalizableValueException constructor (with path and useMessageForUser params) doesn't exist on lowest Symfony versions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
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.
When a NotNormalizableValueException has canUseMessageForUser() = true, use its message directly as the constraint violation message instead of the generic Type constraint message. This fixes issues with Symfony 8.x where expectedTypes can be null/empty, producing broken messages.