Replace template rendering code with Respect\StringFormatter#1615
Merged
henriquemoody merged 1 commit intoRespect:mainfrom Jan 21, 2026
Merged
Replace template rendering code with Respect\StringFormatter#1615henriquemoody merged 1 commit intoRespect:mainfrom
henriquemoody merged 1 commit intoRespect:mainfrom
Conversation
80d92bf to
9153abe
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1615 +/- ##
============================================
+ Coverage 97.81% 97.93% +0.11%
+ Complexity 1007 958 -49
============================================
Files 212 197 -15
Lines 2339 2228 -111
============================================
- Hits 2288 2182 -106
+ Misses 51 46 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request migrates the validation library's message formatting infrastructure to use the external "respect/string-formatter" library, replacing custom implementations with standardized components.
Changes:
- Replaces custom Translator, Modifier, and Stringifier implementations with external library equivalents
- Removes internal message formatting classes (Placeholder classes, modifier implementations)
- Updates to use Symfony TranslatorInterface and respect/stringifier v3.0
- Changes placeholder pipe syntax from 'listOr'/'listAnd' to 'list:or'/'list:and'
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| composer.json | Adds respect/string-formatter dependency, upgrades respect/stringifier to v3.0, adds symfony/translation dev dependency |
| library/ContainerRegistry.php | Reconfigures DI container to use external formatter/stringifier components instead of internal implementations |
| library/Message/InterpolationRenderer.php | Simplified to delegate formatting to PlaceholderFormatter from external library |
| library/Message/Handler/*.php | New handler classes replacing old stringifier implementations |
| library/Exceptions/ValidationException.php | Constructor changed to accept ResultQuery instead of separate message arrays |
| library/ValidatorBuilder.php | Updated to pass ResultQuery to ValidationException constructor |
| tests/unit/Message/InterpolationRendererTest.php | Refactored tests with weaker assertions due to delegation to external library |
| tests/unit/Message/Handler/ResultStringifierTest.php | Updated to use new Handler API instead of Stringifier |
| tests/library/Message/*.php | New test helper classes implementing Symfony TranslatorInterface |
| tests/library/Builders/ResultBuilder.php | Renamed withPath() to path(), added hasPrecedentName() method |
| tests/feature/*.php | Updated tests for new modifier syntax and ValidationException API |
| docs/messages/placeholder-pipes.md | Documentation updated for new 'list:or' and 'list:and' syntax |
| phpstan.neon.dist | Updated suppressions (with one error in method name reference) |
| Deleted files | Removed 20+ internal implementation files now replaced by external libraries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ed593f6 to
f31efef
Compare
henriquemoody
commented
Jan 21, 2026
henriquemoody
commented
Jan 21, 2026
henriquemoody
commented
Jan 21, 2026
henriquemoody
commented
Jan 21, 2026
3c71b96 to
95055a5
Compare
alganet
previously approved these changes
Jan 21, 2026
I've moved almost all the code for placeholder replacement and parameter modifiers into an external library called Respect\StringFormatter. This approach allows us to evolve the template capabilities without making major changes to the Validation's code. This commit will introduce another dependency, `respect/string-formatter`, and will upgrade the version of `respect/string-formatter`, which simplifies our internal API greatly. While making this change, I also updated how we generate exceptions. Instead of rendering the full message and the array of messages, we delegate that creation to the `ResultQuery`, which improves performance because we don’t need to render those big messages unless the user actually needs them.
95055a5 to
a372a0b
Compare
alganet
approved these changes
Jan 21, 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.
I've moved almost all the code for placeholder replacement and parameter modifiers into an external library called Respect\StringFormatter. This approach allows us to evolve the template capabilities without making major changes to the Validation code.
This commit will introduce another dependency,
respect/string-formatter, and will upgrade the version ofrespect/string-formatter, which simplifies our internal API greatly.While making this change, I also updated how we generate exceptions. Instead of rendering the full message and the array of messages, we delegate that creation to the
ResultQuery, which improves performance because we don’t need to render those big messages unless the user actually needs them.