Passed
Pull Request — main (#493)
by
unknown
16:26 queued 01:27
created

InvalidTruncFieldException::forNonLiteralNode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception;
6
7
use Doctrine\DBAL\Types\ConversionException;
8
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateTrunc;
9
10
/**
11
 * @since 3.7
12
 *
13
 * @author Jan Klan <[email protected]>
14
 */
15
class InvalidTruncFieldException extends ConversionException
16
{
17
    public static function forNonLiteralNode(string $nodeClass, string $functionName): self
18
    {
19
        return new self(\sprintf(
20
            'The date_trunc field parameter for %s must be a string literal, got %s',
21
            $functionName,
22
            $nodeClass
23
        ));
24
    }
25
}
26