Closed Legion112 closed 1 year ago
true, with ref that // string is accepted if fractional part is zero $fiver = new Money('500.00', new Currency('USD'));
Docs should mention about minimal currency eg CENTS, USD but CENTS. because many devs think as it is, USD = Dollars.
recommend rewiring them to the real method with throws doc block.
How would that look like?
How would that look like? Writing method and putting there php throw doc block?
Nothing holds you from using the real constructor new Money(100, new Currency('EUR'))
or creating your own factory method/class that adds an @throws. These factory methods are created for IDE and DX purposes. While I was never in favor of this, I believe Mark was right that it was an OK comprise. This issue won't be fixed.
The magic methods
Do not tell the static analyzer about the possible exception that might be thrown. I recommend rewiring them to the real method with throws doc block.