Closed bendavies closed 1 year ago
Hi there,
Given:
$currencies = new \Money\Currencies\ISOCurrencies(); $money = \Money\Money::USD(10); //10 cent $money->roundToUnit($currencies->subunitFor($money->getCurrency()));
should return \Money\Money::USD(0)
\Money\Money::USD(0)
but will throw:
Fatal error: Uncaught InvalidArgumentException: Leading zeros are not allowed in /vendor/moneyphp/money/src/Number.php:216 Stack trace: #0 /vendor/moneyphp/money/src/Number.php(44): Money\Number::parseIntegerPart('000') #1 /vendor/moneyphp/money/src/Number.php(53): Money\Number->__construct('000', '') #2 /vendor/moneyphp/money/src/Money.php(81): Money\Number::fromString('000') #3 /vendor/moneyphp/money/src/Money.php(410): Money\Money->__construct('000', Object(Money\Currency)) #4 /test.php(10): Money\Money->roundToUnit(2) #5 {main}
Thanks
I am not able to reproduce this. What should I change in PR #741?
looking...
@frederikbosch example updated from 1 cent to 10 cents.
Hi there,
Given:
should return
\Money\Money::USD(0)
but will throw:
Thanks