| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | 1 | public function process(PropertyDefinition $propertyDefinition, ClassDefinition $classDefinition, array $propertyData, array $classList): void |
|
| 32 | { |
||
| 33 | 1 | $isCollection = $propertyData[PreparationProcessorInterface::PROP_TYPE_IS_COLLECTION] ?? false; |
|
| 34 | 1 | $isRequired = $propertyDefinition->isRequired(); |
|
| 35 | 1 | if (!$isCollection) { |
|
| 36 | 1 | return; |
|
| 37 | } |
||
| 38 | |||
| 39 | // $propTypes = $propertyDefinition->getTypes(); |
||
| 40 | 1 | $types = [ |
|
| 41 | 1 | 'iterable', |
|
| 42 | 1 | ]; |
|
| 43 | |||
| 44 | 1 | if (!$isRequired) { |
|
| 45 | 1 | $types[] = 'null'; |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | $propertyDefinition->setTypes($types); |
|
| 49 | 1 | $propertyDefinition->setIsCollection(true); |
|
| 50 | |||
| 51 | 1 | $classDefinition->addUseStatement(Collection::class); |
|
| 52 | } |
||
| 54 |