Passed
Pull Request — main (#24)
by Anatoly
04:51 queued 15s
created

Relationship   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
c 1
b 0
f 0
dl 0
loc 24
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Nekhay <[email protected]>
7
 * @copyright Copyright (c) 2021, Anatoly Nekhay
8
 * @license https://github.com/sunrise-php/hydrator/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/hydrator
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sunrise\Hydrator\Annotation;
15
16
use Attribute;
17
18
/**
19
 * @Annotation
20
 * @Target({"PROPERTY"})
21
 * @NamedArgumentConstructor
22
 *
23
 * @Attributes({
24
 *     @Attribute("target", type="string", required=true),
25
 *     @Attribute("limit", type="integer", required=false),
26
 * })
27
 *
28
 * @since 3.0.0
29
 */
30
#[Attribute(Attribute::TARGET_PROPERTY)]
31
final class Relationship
32
{
33
34
    /**
35
     * @var class-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
36
     */
37
    public string $target;
38
39
    /**
40
     * @var int<1, max>|null
41
     */
42
    public ?int $limit;
43
44
    /**
45
     * Constructor of the class
46
     *
47
     * @param class-string $target
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
48
     * @param int<1, max>|null $limit
49
     */
50 18
    public function __construct(string $target, ?int $limit = null)
51
    {
52 18
        $this->target = $target;
53 18
        $this->limit = $limit;
54
    }
55
}
56