Issues (49)

src/Annotation/Relation/Relation.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Annotated\Annotation\Relation;
6
7
abstract class Relation implements RelationInterface
8
{
9
    // relation type
10
    protected const TYPE = '';
11
12
    /**
13
     * @param non-empty-string|null $target
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string|null at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string|null.
Loading history...
14
     * @param non-empty-string $load
15
     */
16 808
    public function __construct(
17
        protected ?string $target,
18
        protected string $load = 'lazy',
19
    ) {
20 808
    }
21
22 808
    public function getType(): string
23
    {
24 808
        return static::TYPE;
25
    }
26
27 808
    public function getTarget(): ?string
28
    {
29 808
        return $this->target;
30
    }
31
32
    public function getLoad(): ?string
33
    {
34
        return $this->load;
35
    }
36
37 808
    public function getOptions(): array
38
    {
39 808
        $options = get_object_vars($this);
40 808
        unset($options['target'], $options['inverse']);
41
42 808
        return $options;
43
    }
44
}
45