[12.x] Revert lowercasing validation message placeholders #57733
+19
−1
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.
This PR reverts the minor breaking change around placeholder capitalization reported in #57678. The issue was that certain placeholder values were explicitly lowercased, whereas previously they were not. This PR restores the prior behavior and keeps things consistent again with
:attribute, which does not explicitly lowercase.Example
The change was introduced in #57564 and already pointed out by #57564 (comment).
Several attempts to fix this have already been made (#57679, #57686). This PR simply removes the
Str::lower(...)call. It focuses on reverting the breaking change and introducing test cases to ensure future correctness. Others are welcome to open further PRs for refactoring if deemed necessary.I've gone through each rule and manually checked if the lowercasing change affected them:
accepted_if:
:other— no; field name is converted to snake_case, so explicit lowercasing has no additional effect:value— yessame, in_array, prohibits:
:other— no; field name is converted to snake_casemissing_with, required_with, present_with:
:values— no; field names are converted to snake_caserequired_unless, starts_with:
no — does not use
replaceWhileKeepingCase, which introduced the change (test cases still added for completeness)For all the listed rules above there are unique method implementations inside
ReplacesAttributes. Methods for other rules just call one of the above rules' methods (e.g.,replaceRequiredIfcallsreplaceAcceptedIf). This is also why, in my initial PR #57556, I only added test cases for the rules above, as they cover the remaining delegated rules as well.