-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
Description
I'm not sure if I'm doing something wrong but if I modify this:
framework/demo/Demo/Account.php
Lines 42 to 51 in c508a19
| /** | |
| * Returns current balance | |
| * | |
| * @Contract\Ensure("$__result == $this->balance") | |
| * @return float | |
| */ | |
| public function getBalance() | |
| { | |
| return $this->balance; | |
| } |
into this:
/**
* {@inheritdoc}
*/
public function getBalance()
{
// return $this->balance;
return 10;
}I should've receive the following error:
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
PhpDeal\Exception\ContractViolation: Contract $__result == $this->balance violated for Demo\Account->getBalance in deal/demo/Account.php on line 51
instead, I'm getting:
$ php demo.php
10
this:
/**
* Returns current balance
*
* @Contract\Ensure("$__result == $this->balance")
* @return float
*/
public function getBalance()
{
// return $this->balance;
return 10;
}returns the above-mentioned error as expected.