Use format for error message dates when unset (#709)#790
Use format for error message dates when unset (#709)#790WarLikeLaux wants to merge 3 commits intoyiisoft:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #790 +/- ##
============================================
- Coverage 94.40% 9.55% -84.85%
- Complexity 953 1047 +94
============================================
Files 108 122 +14
Lines 3018 3234 +216
============================================
- Hits 2849 309 -2540
- Misses 169 2925 +2756 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates date/time validation error message formatting so that when message-specific formatting options aren’t provided, the rule’s format is used to render limit values in error messages (addressing #709). This changes default error message output and is a documented BC break.
Changes:
- Update
BaseDateHandler::formatDate()to fall back to the rule’sformatwhen message format/type options are unset. - Adjust existing date/time rule tests to match the new formatting behavior.
- Add new test cases to verify precedence between
formatand message-format settings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Rule/Date/BaseDateHandler.php |
Implements fallback to rule format for error-message date/time formatting when message formatting isn’t configured. |
tests/Rule/Date/DateTest.php |
Updates expectations and adds coverage for format-driven message formatting and messageFormat override behavior. |
tests/Rule/Date/DateTimeTest.php |
Updates expected min/max/timestamp error message formatting to use the rule format. |
tests/Rule/Date/TimeTest.php |
Updates expected time error message formatting and adds a precedence test for format vs handler message type. |
CHANGELOG.md |
Adds a changelog entry for the behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What does this PR do?
In date rules, use
formatproperty for formatting dates in error messages whenmessageFormatandmessageDateType/messageTimeTypeare not set.BC break
When
formatis set butmessageFormatis not, dates in error messages are now formatted usingformatinstead ofIntlDateFormatter::SHORT.Before:
After:
To keep the old behavior, set
messageFormatormessageDateTypeexplicitly.Coverage
Tests: 77 → 80. Line coverage: 115/115 (100%) → 119/119 (100%). MSI: 95% (111/116) → 95% (118/123).