Total Complexity | 6 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | final class FieldMap implements \IteratorAggregate |
||
19 | { |
||
20 | /** @var Field[] */ |
||
21 | private $fields = []; |
||
22 | |||
23 | /** |
||
24 | * @param string $name |
||
25 | * @return bool |
||
26 | */ |
||
27 | public function has(string $name): bool |
||
28 | { |
||
29 | return isset($this->fields[$name]); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param string $name |
||
34 | * @return Field |
||
35 | */ |
||
36 | public function get(string $name): Field |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param string $name |
||
47 | * @param Field $field |
||
48 | * @return FieldMap |
||
49 | */ |
||
50 | public function set(string $name, Field $field): self |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return Field[]|\Traversable |
||
63 | */ |
||
64 | public function getIterator() |
||
67 | } |
||
68 | } |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: