Failed Conditions
Pull Request — develop (#3525)
by Jonathan
09:58
created

UnknownColumnType::new()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 12
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.9
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Types\Exception;
6
7
use Doctrine\DBAL\DBALException;
8
use function sprintf;
9
10
final class UnknownColumnType extends DBALException implements TypesException
11
{
12 27
    public static function new(string $name) : self
13
    {
14 27
        return new self(
15 27
            sprintf(
16
                'Unknown column type "%s" requested. Any Doctrine type that you use has '
17
                    . 'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the '
18
                    . 'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database '
19
                    . 'introspection then you might have forgotten to register all database types for a Doctrine Type. '
20
                    . 'Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement '
21
                    . 'Type#getMappedDatabaseTypes(). If the type name is empty you might '
22 2
                    . 'have a problem with the cache or forgot some mapping information.',
23 27
                $name
24
            )
25
        );
26
    }
27
}
28