moneyphp / money

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

Allow integer as multiplier for `Money::multiply` and divisor for `Money::divide` #648

Closed ruudk closed 3 years ago

ruudk commented 3 years ago

Our application calculates a lot with Money::multiply and Money::divide. When trying to upgrade to Money v4.0.0 I needed to add (string) casts to almost all of the multiplier/divisors. It makes the code harder to read.

I wonder if it's really needed, as Money::__construct also takes integers now. Can't we do the same for Money::multiply and Money::divide?

What do you think?

frederikbosch commented 3 years ago

I think this is very helpful indeed. Maybe investigate whether more methods have this problem.

frederikbosch commented 3 years ago

Great, thanks!

frederikbosch commented 3 years ago

I will wait until the end of the week with tagging 4.0.1 (please remind me if I forgot ...)

frederikbosch commented 3 years ago

Tagged, specifically to fix this issue, thanks again!