Repository navigation
Add support for Money based formatters - new - #105
Merged
Merged
Conversation
BenMorel
requested changes
Nov 24, 2025
Comment on lines
+698
to
+699
| * @deprecated Use MoneyLocaleFormatter::format($money). | ||
| * |
Member
There was a problem hiding this comment.
I think that we should keep a Money::format() method, that does what formatTo() does currently. Can you please add it? We'll then deprecate formatTo() in favour of format().
Suggested change
| * @deprecated Use MoneyLocaleFormatter::format($money). | |
| * | |
| * @deprecated Use Money::format(). | |
| * |
Contributor
Author
There was a problem hiding this comment.
Done, but I don't know if that's what you had in mind. Feel free to elaborate, and I'll make adjustments.
- I restored the old
Money::formatTo(). - Since
Money::formatTo()has been restored to the old form, I also restoredMoney::formatWith(). It feels right asMoney::formatTo()callsMoney::formatWith(). - I added
Money::format().
Co-authored-by: Benjamin Morel <benjamin.morel@gmail.com>
BenMorel
requested changes
Jan 15, 2026
Contributor
Author
|
@BenMorel, I applied all the suggested fixes. |
Member
|
Thank you, @mklepaczewski! |
Member
|
@mklepaczewski FYI, I moved formatters to the |
Member
|
Released in 0.11.0. |
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.
Replaces #103
Summary
MoneyFormatterinterface with a singleMoneyFormatter::format(Money $money) : stringmethodMoney::formatWith()andMoney::formatTo()MoneyLocaleFormatterandMoneyNumberFormatterto replaceMoney::formatWith()andMoney::formatTo()Notes
Money::formatWith()andMoney::formatTo(). I assume these tests should be removed together with the methodsMoneyNumberFormatterandMoneyLocaleFormatterare almost copy-pasted fromMoney::formatWith()andMoney::formatTo()MoneyNumberFormatterinMoneyLocaleFormatteras it led to a weird design where the scale used byMoneyNumberFormatteris manipulated fromMoneyLocaleFormatter::format()