| Total Complexity | 8 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | #[Immutable] |
||
| 15 | final class ConstraintsHelper |
||
| 16 | { |
||
| 17 | private function __construct() |
||
| 19 | } |
||
| 20 | |||
| 21 | 15 | public static function createCollection(array $fields, bool $allowExtraFields = true, bool $allowMissingFields = true): Collection |
|
| 22 | { |
||
| 23 | 15 | return new Collection(fields: $fields, allowExtraFields: $allowExtraFields, allowMissingFields: $allowMissingFields); |
|
| 24 | } |
||
| 25 | |||
| 26 | /** @return array<Constraint> */ |
||
| 27 | 2 | public static function fromProperty(\ReflectionProperty $rProperty): array |
|
| 28 | { |
||
| 29 | 2 | return AttributeHelper::getAttributes($rProperty, Constraint::class); |
|
| 30 | } |
||
| 31 | |||
| 32 | 15 | public static function getArrayTypeAttribute(\ReflectionProperty $rProperty): ?ArrayType |
|
| 35 | } |
||
| 36 | |||
| 37 | 20 | public static function hasArrayTypeAttribute(\ReflectionProperty $rProperty): bool |
|
| 38 | { |
||
| 39 | 20 | return 'array' === PropertyHelper::getTypeName($rProperty) && null !== AttributeHelper::getAttribute($rProperty, ArrayType::class); |
|
| 40 | } |
||
| 41 | |||
| 42 | 19 | public static function hasArrayDocBlock(\ReflectionProperty $rProperty, PhpDocReader $reader): bool |
|
| 45 | } |
||
| 46 | } |
||
| 47 |