Passed
Push — 3.x ( 6aff79...9d7be0 )
by Aleksei
04:54
created

JoinedTable::getFkAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Annotated\Annotation\Inheritance;
6
7
use Cycle\Annotated\Annotation\Inheritance;
8
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
9
use JetBrains\PhpStorm\ExpectedValues;
10
11
/**
12
 * @Annotation
13
 * @NamedArgumentConstructor
14
 * @Target("CLASS")
15
 */
16
#[\Attribute(\Attribute::TARGET_CLASS), NamedArgumentConstructor]
17
class JoinedTable extends Inheritance
18
{
19
    /**
20
     * @param non-empty-string|null $outerKey Outer (parent) key name.
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...
21
     * @param bool $fkCreate Set to true to automatically create FK on outerKey.
22
     * @param non-empty-string|null $fkAction FK onDelete and onUpdate action.
23
     */
24 144
    public function __construct(
25
        private ?string $outerKey = null,
26
        private bool $fkCreate = true,
27
        /**
28
         * @Enum({"NO ACTION", "CASCADE", "SET NULL"})
29
         */
30
        #[ExpectedValues(values: ['NO ACTION', 'CASCADE', 'SET NULL'])]
31
        private ?string $fkAction = 'CASCADE',
32
    ) {
33 144
        parent::__construct('joined');
34 144
    }
35
36 144
    public function getOuterKey(): ?string
37
    {
38 144
        return $this->outerKey;
39
    }
40
41 144
    public function isCreateFk(): bool
42
    {
43 144
        return $this->fkCreate;
44
    }
45
46 96
    public function getFkAction(): string
47
    {
48 96
        return $this->fkAction;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->fkAction could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
49
    }
50
}
51