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
A violation with a contract should not throw a DomainException with
Fatal error: Uncaught DomainException: Invalid return value received from the assertion body, only boolean or void can be returned in deal/demo/Account.php on line 51
To reproduce this, simply change the demo Account::getBalance to return any value instead 100.
It should instead raise an ContractViolation explaining what contract was violated with what value.
Somthing like this:
PHP Fatal error: Uncaught PhpDeal\Exception\ContractViolation: Contract $amount>0 && is_numeric($amount) violated with -1 for Demo\Account->deposit in XXX
Since this will change exceptions raised, this is assumed a breaking change.
To change this, one has to change the AbstractContractAspect inside ensureContracts. If the $invocationResult equals false, a ContractViolation should be raised.
The text was updated successfully, but these errors were encountered:
If contract validation result is bool but false, we will throw a
ContractViolation instead of a DomainException. This will make sure, the
topmost exception is clear and understandable.
Source branch: 1.x
A violation with a contract should not throw a
DomainException
withTo reproduce this, simply change the demo
Account::getBalance
to return any value instead100
.It should instead raise an
ContractViolation
explaining what contract was violated with what value.Somthing like this:
Since this will change exceptions raised, this is assumed a breaking change.
To change this, one has to change the
AbstractContractAspect
insideensureContracts
. If the$invocationResult
equalsfalse
, aContractViolation
should be raised.The text was updated successfully, but these errors were encountered: