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

NonVisitableTypeException::fromDataAndType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
rs 10
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