moneyphp / money

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

roundToUnit ignores ROUND_UP #708

Closed arokettu closed 1 year ago

arokettu commented 2 years ago
$f = new \Money\Formatter\DecimalMoneyFormatter(new \Money\Currencies\ISOCurrencies());
$sum = \Money\Money::EUR('1234');
echo $f->format($sum->roundToUnit(2, \Money\Money::ROUND_UP));

expected: 13.00 actual: 12.00

Likely the method should use $this->round instead of self::$calculator::round