| Total Complexity | 7 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | final class ConstraintsHelper |
||
| 16 | { |
||
| 17 | 15 | public static function createCollection(array $fields, bool $allowExtraFields = true, bool $allowMissingFields = true): Collection |
|
| 18 | { |
||
| 19 | 15 | return new Collection(fields: $fields, allowExtraFields: $allowExtraFields, allowMissingFields: $allowMissingFields); |
|
| 20 | } |
||
| 21 | |||
| 22 | /** @return array<Constraint> */ |
||
| 23 | 2 | public static function fromProperty(\ReflectionProperty $rProperty): array |
|
| 24 | { |
||
| 25 | 2 | return AttributeHelper::getAttributes($rProperty, Constraint::class); |
|
| 26 | } |
||
| 27 | |||
| 28 | 15 | public static function getArrayTypeAttribute(\ReflectionProperty $rProperty): ?ArrayType |
|
| 31 | } |
||
| 32 | |||
| 33 | 23 | public static function hasArrayTypeAttribute(\ReflectionProperty $rProperty): bool |
|
| 34 | { |
||
| 35 | 23 | return 'array' === $rProperty->getType()?->getName() && null !== AttributeHelper::getAttribute($rProperty, ArrayType::class); |
|
|
|
|||
| 36 | } |
||
| 37 | |||
| 38 | 19 | public static function hasArrayDocBlock(\ReflectionProperty $rProperty, PhpDocReader $reader): bool |
|
| 41 | } |
||
| 42 | } |
||
| 43 |