BruceGitHub /
minimal-vo
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace MinimalVo\BaseValueObject; |
||
| 6 | |||
| 7 | use MinimalVo\FactoryTrait\BooleanVoFactoryTrait; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @template-extends AbstractVo<bool,BooleanVo> |
||
| 11 | */ |
||
| 12 | final class BooleanVo extends AbstractVo |
||
| 13 | { |
||
| 14 | use BooleanVoFactoryTrait; |
||
| 15 | |||
| 16 | public function equal($vo): bool |
||
| 17 | { |
||
| 18 | return $this->value === $vo->toValue(); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function duplicate() |
||
| 22 | { |
||
| 23 | return new self($this->value); |
||
|
0 ignored issues
–
show
|
|||
| 24 | } |
||
| 25 | |||
| 26 | protected function valid(): bool |
||
| 27 | { |
||
| 28 | return is_bool($this->value); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: