Conditions | 8 |
Paths | 6 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
28 | 255 | public function validate(): void |
|
29 | { |
||
30 | 255 | if ($this->property->isPk()) { |
|
31 | 29 | if (!$this->property->isRequired()) { |
|
32 | 3 | throw new InvalidSchemaAttributeException('Primary Key must be required.'); |
|
33 | } |
||
34 | |||
35 | 26 | if ($this->property->isFk()) { |
|
36 | 2 | throw new InvalidSchemaAttributeException('Primary Key cannot be Foreing Key too.'); |
|
37 | } |
||
38 | |||
39 | 24 | if ($this->isInt($this->property) && !$this->property->isAi()) { |
|
40 | 1 | throw new InvalidSchemaAttributeException('Primary Key numeric not autoincrement.'); |
|
41 | } |
||
42 | |||
43 | 23 | if ($this->property->isAi() && $this->hasSizing($this->property)) { |
|
44 | 1 | throw new InvalidSchemaAttributeException('Primary Key autoincrement cannot has sizing.'); |
|
45 | } |
||
49 |