| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 6 | public function denormalize($data, Type $type, DenormalizationContext $context) |
|
| 36 | { |
||
| 37 | 6 | $className = $type->name(); |
|
| 38 | /** @var \ArrayAccess&Traversable $denormalized */ |
||
| 39 | 6 | $denormalized = new $className(); |
|
| 40 | |||
| 41 | 6 | foreach ((array)$data as $key => $value) { |
|
| 42 | 6 | $denormalized[$key] = $context->root()->denormalize( |
|
| 43 | 6 | $value, |
|
| 44 | 6 | $type->isParametrized() ? $type->subType() : TypeFactory::mixedType(), |
|
| 45 | 6 | $context |
|
| 46 | 6 | ); |
|
| 47 | } |
||
| 48 | |||
| 49 | 6 | return $denormalized; |
|
|
|
|||
| 50 | } |
||
| 60 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: