Total Complexity | 5 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Node implements NodeInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var DescriptorInterface |
||
11 | */ |
||
12 | private $value; |
||
13 | /** |
||
14 | * @var DescriptorInterface[] |
||
15 | */ |
||
16 | private $parents = []; |
||
17 | |||
18 | /** |
||
19 | * @param DescriptorInterface $value |
||
20 | */ |
||
21 | public function __construct(DescriptorInterface $value = null) |
||
22 | { |
||
23 | $this->value = $value; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return DescriptorInterface |
||
28 | */ |
||
29 | public function getValue(): DescriptorInterface |
||
30 | { |
||
31 | return $this->value; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param DescriptorInterface $value |
||
36 | * @return $this |
||
37 | */ |
||
38 | public function setValue(DescriptorInterface $value): Node |
||
39 | { |
||
40 | $this->value = $value; |
||
41 | return $this; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return DescriptorInterface[] |
||
46 | */ |
||
47 | public function getParents(): array |
||
48 | { |
||
49 | return $this->parents; |
||
|
|||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param DescriptorInterface[] $parents |
||
54 | * @return $this |
||
55 | */ |
||
56 | public function setParents(array $parents): Node |
||
60 | } |
||
61 | } |
||
62 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: