moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.62k stars 440 forks source link

Accept leading zeros #704

Closed PowerKiKi closed 2 years ago

PowerKiKi commented 2 years ago

This is a direct follow-up to 2f1dbf1afde48dbe98402e5e8aa450434def234f, from #702, that started to allow leading zeros in some places, but did not actually allow them everywhere.

PowerKiKi commented 2 years ago

@frederikbosch, it would probably be best to merge this PR before cutting a release, otherwise the PR #702 would not be super useful

frederikbosch commented 2 years ago

@PowerKiKi I would prefer to only accept leading zero's in the parsers, and not in the Number/Money objects.

PowerKiKi commented 2 years ago

You know what ? I think you are right. Parsing with DecimalMoneyParser or creating a new Money object is not the same use-case. And it makes sense that Money might be stricter than DecimalMoneyParser.

I wished I had thought a bit more about that before creating this PR 😅