| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | public function __invoke(array $data, HydratorContainerInterface $hydrators) |
||
| 9 | { |
||
| 10 | // FIXME: Refactor hydration to allow generic hydrators |
||
| 11 | $ref = new \ReflectionClass($class); |
||
|
|
|||
| 12 | $object = $ref->newInstanceWithoutConstructor(); |
||
| 13 | |||
| 14 | foreach($ref->getProperties() as $property) { |
||
| 15 | $property->setAccessible(true); |
||
| 16 | $property->setValue($object, $data[$property->getName()]); |
||
| 17 | } |
||
| 18 | |||
| 19 | return $object; |
||
| 20 | } |
||
| 21 | } |
||
| 22 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.