You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, PHPStan currently warns that the method signature of TaxedMoney::__construct() is not enforced to be equal to the Money constructor signature:
Unsafe usage of new static().
💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static
Both issues can be resolved by introducing a MoneyInterface class, which needs to be implemented by both the Money and TaxedMoney classes. The interface should contain abstract methods for the constructor and calculation methods.
The multiply() method is currently in use in Gravity Forms subscription period alignment, where losing tax details is fine as we're not specifying taxes for the payment lines in this integration.
The text was updated successfully, but these errors were encountered:
When performing calculations in a
TaxedMoney
object, the tax details are removed.This is caused by the fact that we're instantiating a new
static
(eitherMoney
orTaxedMoney
) object from e.g. themultiply()
method.wp-money/src/Money.php
Lines 328 to 344 in 6b144b3
Also, PHPStan currently warns that the method signature of
TaxedMoney::__construct()
is not enforced to be equal to theMoney
constructor signature:Both issues can be resolved by introducing a
MoneyInterface
class, which needs to be implemented by both theMoney
andTaxedMoney
classes. The interface should contain abstract methods for the constructor and calculation methods.The
multiply()
method is currently in use in Gravity Forms subscription period alignment, where losing tax details is fine as we're not specifying taxes for the payment lines in this integration.The text was updated successfully, but these errors were encountered: