Code Duplication    Length = 11-12 lines in 3 locations

src/Type/BooleanType.php 1 location

@@ 15-26 (lines=12) @@
12
     *
13
     * @param mixed $value
14
     */
15
    public function __construct($value)
16
    {
17
        // We cannot use type hint here because of this: https://3v4l.org/W9F7o
18
        if (false === \is_bool($value)) {
19
            throw new \TypeError(
20
                'Argument 1 passed to drupol\valuewrapper\Type\BooleanType::__construct() must be of the type boolean, '
21
                . gettype($value) . ' given.'
22
            );
23
        }
24
25
        parent::__construct($value);
26
    }
27
28
    /**
29
     * {@inheritdoc}

src/Type/NullType.php 1 location

@@ 15-25 (lines=11) @@
12
     *
13
     * @param null $value
14
     */
15
    public function __construct($value)
16
    {
17
        if (!\is_null($value)) {
18
            throw new \TypeError(
19
                'Argument 1 passed to drupol\valuewrapper\Type\NullType::__construct() must be of the type null, ' .
20
                gettype($value) . ' given.'
21
            );
22
        }
23
24
        parent::__construct($value);
25
    }
26
}
27

src/Resource/ResourceValue.php 1 location

@@ 14-25 (lines=12) @@
11
     *
12
     * @param mixed $value
13
     */
14
    public function __construct($value)
15
    {
16
        // We cannot use type hint here because of this: https://3v4l.org/W9F7o
17
        if (false === \is_resource($value)) {
18
            throw new \TypeError(
19
                'Argument 1 passed to drupol\valuewrapper\Resource\ResourceValue::__construct()' .
20
                'must be of the type Resource, ' . gettype($value) . ' given.'
21
            );
22
        }
23
24
        parent::__construct($value);
25
    }
26
27
    /**
28
     * {@inheritdoc}