Test Failed
Push — master ( b7ab7b...94ee03 )
by Kirill
02:59
created

NonNullType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __toString() 0 4 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\SDL\IR\Type;
11
12
/**
13
 * Class NonNullType
14
 */
15
class NonNullType extends WrappingType
16
{
17
    /**
18
     * NonNullType constructor.
19
     * @param TypeInterface $parent
20
     */
21
    public function __construct(TypeInterface $parent)
22
    {
23
        parent::__construct(static::NON_NULL, $parent);
24
25
        \assert(! $this->is($parent), __CLASS__ . ' can not be wrapped by itself');
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function __toString(): string
32
    {
33
        return $this->of . '!';
34
    }
35
}
36