Passed
Push — 6.0 ( d42c5f...ee4eb8 )
by Olivier
01:47
created

HasMany   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace ICanBoogie\ActiveRecord\Schema;
4
5
use Attribute;
6
use ICanBoogie\ActiveRecord;
7
8
/**
9
 * Marks a relationship with another model, with the property as reference.
10
 */
11
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
12
final class HasMany implements SchemaAttribute
13
{
14
    /**
15
     * @param class-string<ActiveRecord> $associate
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<ActiveRecord> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<ActiveRecord>.
Loading history...
16
     *     The associate ActiveRecord class.
17
     * @param non-empty-string|null $foreign_key
18
     *      Column key on the associate model, defaults to the local primary key (which might be wrong).
19
     * @param class-string|null $through
20
     *     The pivot ActiveRecord class.
21
     * @param non-empty-string|null $as
22
     *     The name of the accessor, defaults to the associate model's id.
23
     */
24
    public function __construct(
25
        public readonly string $associate,
26
        public readonly ?string $foreign_key = null,
27
        public readonly ?string $through = null,
28
        public readonly ?string $as = null,
29
    ) {
30
    }
31
}
32