Passed
Pull Request — master (#19)
by
unknown
02:11
created

PrimaryKey::getColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Annotated\Annotation\Table;
6
7
use Cycle\Annotated\Annotation\Column;
8
use Doctrine\Common\Annotations\Annotation\Attribute;
9
use Doctrine\Common\Annotations\Annotation\Attributes;
10
use Doctrine\Common\Annotations\Annotation\Target;
11
12
/**
13
 * @Annotation
14
 * @Target("ANNOTATION", "CLASS")
15
 * @Attributes({
16
 *      @Attribute("columns", type="array<string>", required=true),
17
 * })
18
 */
19
#[\Attribute(\Attribute::TARGET_CLASS)]
20
class PrimaryKey
21
{
22
    /** @var string[] */
23
    private $columns = [];
24
25
    public function __construct(array $values)
26
    {
27
        foreach ($values as $key => $value) {
28
            $this->$key = $value;
29
        }
30
    }
31
32
    /**
33
     * @return Column[]
34
     */
35
    public function getColumns(): array
36
    {
37
        return $this->columns;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->columns returns the type string[] which is incompatible with the documented return type Cycle\Annotated\Annotation\Column[].
Loading history...
38
    }
39
}
40