Test Failed
Push — main ( 6e42c7...fc4189 )
by Fractal
02:46
created

ConstraintsHelper::hasArrayDocBlock()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FRZB\Component\RequestMapper\Helper;
6
7
use FRZB\Component\PhpDocReader\Exception\ReaderException;
8
use FRZB\Component\PhpDocReader\Reader\ReaderInterface as PhpDocReader;
9
use FRZB\Component\RequestMapper\Attribute\ArrayType;
10
use JetBrains\PhpStorm\Immutable;
11
use Symfony\Component\Validator\Constraint;
12
use Symfony\Component\Validator\Constraints\Collection;
13
14
/** @internal */
15
#[Immutable]
16
final class ConstraintsHelper
17
{
18
    private function __construct()
19
    {
20
    }
21 15
22
    public static function createCollection(array $fields, bool $allowExtraFields = true, bool $allowMissingFields = true): Collection
23 15
    {
24
        return new Collection(fields: $fields, allowExtraFields: $allowExtraFields, allowMissingFields: $allowMissingFields);
25
    }
26
27 2
    /** @return array<Constraint> */
28
    public static function fromProperty(\ReflectionProperty $rProperty): array
29 2
    {
30
        return AttributeHelper::getAttributes($rProperty, Constraint::class);
31
    }
32
}
33