| Conditions | 8 |
| Paths | 12 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 6 |
| Ratio | 26.09 % |
| Tests | 14 |
| CRAP Score | 8 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 4 | public function toPropertyMetadata(PropertyMetadata $propertyMetadata) |
|
| 28 | { |
||
| 29 | // Get @Inject("value") |
||
| 30 | 4 | $propertyMetadata->injectable = array_shift($this->collection); |
|
| 31 | |||
| 32 | // Check if we need to append namespace to injectable |
||
| 33 | 4 | View Code Duplication | if ($propertyMetadata->injectable !== null && strpos($propertyMetadata->injectable, '\\') === false) { |
| 34 | 1 | $propertyMetadata->injectable = $propertyMetadata->classMetadata->nameSpace . '\\' . $propertyMetadata->injectable; |
|
| 35 | 1 | } |
|
| 36 | |||
| 37 | // Check if we need to append namespace to type hint |
||
| 38 | 4 | View Code Duplication | if ($propertyMetadata->typeHint !== null && strpos($propertyMetadata->typeHint, '\\') === false) { |
| 39 | 1 | $propertyMetadata->typeHint = $propertyMetadata->classMetadata->nameSpace . '\\' . $propertyMetadata->typeHint; |
|
| 40 | 1 | } |
|
| 41 | |||
| 42 | // Check for inheritance violation |
||
| 43 | 4 | if ($propertyMetadata->injectable !== null && $propertyMetadata->typeHint !== null) { |
|
| 44 | 3 | $inheritance = array_merge([$propertyMetadata->injectable], class_parents($propertyMetadata->injectable)); |
|
| 45 | 3 | if (!in_array($propertyMetadata->typeHint, $inheritance, true)) { |
|
| 46 | 1 | throw new \InvalidArgumentException('@Inject dependency violates ' . $propertyMetadata->typeHint . ' inheritance'); |
|
| 47 | } |
||
| 48 | 2 | } |
|
| 49 | 3 | } |
|
| 50 | } |
||
| 51 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.