1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace MinimalVo\BaseValueObject; |
||
6 | |||
7 | use MinimalVo\FactoryTrait\StringVoFactoryTrait; |
||
8 | |||
9 | /** |
||
10 | * @template-extends AbstractVo<string,StringVo> |
||
11 | */ |
||
12 | final class StringVo extends AbstractVo |
||
13 | { |
||
14 | use StringVoFactoryTrait; |
||
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 true; |
||
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: