Passed
Push — master ( 00c5bd...d642a7 )
by Asmir
04:15 queued 01:58
created

NonVisitableTypeException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromDataAndType() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Exception;
6
7
use function get_debug_type;
8
9
final class NonVisitableTypeException extends RuntimeException
10
{
11
    /**
12
     * @param mixed $data
13
     * @param array{name: string}> $type
14
     */
15
    public static function fromDataAndType($data, array $type, ?RuntimeException $previous = null)
16
    {
17
        return new self(
18
            sprintf('Type %s cannot be visited as %s', get_debug_type($data), $type['name']),
19
            0,
20
            $previous
21
        );
22
    }
23
}
24