Total Complexity | 4 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 71.43% |
Changes | 0 |
1 | <?php |
||
15 | 1 | class JsonMapper implements IMapper |
|
16 | { |
||
17 | |||
18 | /** |
||
19 | * Convert array or Traversable input to string output response |
||
20 | * @param string|object|iterable<string|int, mixed> $data |
||
21 | * @param bool $prettyPrint |
||
22 | * @throws MappingException |
||
23 | * @return string |
||
24 | */ |
||
25 | public function stringify(iterable|string|object $data, bool $prettyPrint = true): string |
||
31 | } |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Convert client request data to array or traversable |
||
36 | * @param mixed $data |
||
37 | * @throws MappingException |
||
38 | * @return iterable<string|int, mixed> |
||
39 | */ |
||
40 | public function parse(mixed $data): iterable |
||
49 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: