NullType::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace drupol\valuewrapper\Type;
6
7
use TypeError;
8
9
use function gettype;
10
11
/**
12
 * Class NullType.
13
 */
14
class NullType extends TypeValue
15
{
16
    /**
17
     * NullType constructor.
18
     *
19
     * @param mixed $value
20
     */
21 10
    public function __construct($value)
22
    {
23 10
        if (null !== $value) {
24 1
            throw new TypeError(
25
                'Argument 1 passed to drupol\valuewrapper\Type\NullType::__construct() must be of the type null, ' .
26 1
                gettype($value) . ' given.'
27
            );
28
        }
29
30 9
        parent::__construct($value);
31 9
    }
32
}
33