Added
- New ISO 4217 currencies: MRU, SLE, STN, XCG and ZWG. They replace withdrawn codes (akaunting/akaunting#3413, @yu2971512385-ui)
Changed
- IRR subunit is now
1instead of100(#123, @ariaieboy) - Only
Closureinstances are called as callable amounts. Other callables, such as function-name strings or[Class, 'method']arrays, now throwUnexpectedAmountException convert()no longer changes the original object when the instance is immutable. It returns a new instance insteadallocate()throwsInvalidArgumentExceptionwhen the ratios are empty or sum to zero
Fixed
allocate()now distributes float amounts correctly, so the shares always add up to the original amount- The
currency_codevalidation rule returnsfalsefor non-string input instead of throwing aTypeError - Tiny negative amounts that round to zero are no longer formatted as negative zero (
-$0.00) - Calling a currency factory without an amount (
Money::USD()) throws a clearUnexpectedAmountException - The bundled currency config is loaded only once
- Mixin example in README (#119, @netzknecht)
Upgrade notes
- IRR: if you store IRR amounts in subunits (that is, you create Money without
convert: true), the same stored value is now read 100 times larger. For example,Money::IRR(1500)used to show ﷼15 and now shows ﷼1,500. Amounts created withconvert: trueare not affected. - If you pass amounts as callable strings or arrays, wrap them in a closure:
fn () => ....