ArrayType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 9
c 1
b 0
f 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of the sj-i/phpdoc-type-reader package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpDocTypeReader\Type;
15
16
class ArrayType extends AtomicType
17
{
18
    /** @var Type[] */
19
    public array $parameter_types;
20
21
    public ArrayKeyType $key_type;
22
23
    public Type $value_type;
24
25
    public function __construct(Type $value_type, ?ArrayKeyType $key_type = null)
26
    {
27
        if (is_null($key_type)) {
28
            $key_type = new ArrayKeyType();
29
        }
30
        $this->key_type = $key_type;
31
        $this->value_type = $value_type;
32
        $this->parameter_types = [$value_type, $key_type];
33
    }
34
}
35