Test Setup Failed
Push — master ( 1595cb...1df194 )
by Kirill
02:11
created

TypeName::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Frontend\Ast;
13
14
/**
15
 * Class TypeName
16
 */
17
class TypeName extends Identifier
18
{
19
    /**
20
     * @var array|Identifier[]
21
     */
22
    public array $arguments = [];
23
24
    /**
25
     * Name constructor.
26
     *
27
     * @param Identifier $name
28
     * @param array|Identifier[] $arguments
29
     */
30
    public function __construct(Identifier $name, array $arguments = [])
31
    {
32
        parent::__construct($name->value);
33
34
        $this->arguments = $arguments;
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function isGeneric(): bool
41
    {
42
        return $this->arguments !== [];
43
    }
44
45
    /**
46
     * @param array|Identifier[] $children
47
     * @return Identifier
48
     */
49
    public static function create($children): Identifier
50
    {
51
        return new static(\array_shift($children), $children);
52
    }
53
}
54