Skip to content

Commit cf0e185

Browse files
committed
Fixed custom doctrine type exceptions
1 parent 4e0df79 commit cf0e185

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Doctrine/DBAL/Types/EnumType.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use App\Enum\Interfaces\DatabaseEnumInterface;
1212
use BackedEnum;
1313
use Doctrine\DBAL\Platforms\AbstractPlatform;
14-
use Doctrine\DBAL\Types\ConversionException;
14+
use Doctrine\DBAL\Types\Exception\InvalidFormat;
1515
use Doctrine\DBAL\Types\Type;
1616
use InvalidArgumentException;
1717
use Override;
@@ -20,6 +20,7 @@
2020
use function implode;
2121
use function in_array;
2222
use function is_string;
23+
use function sprintf;
2324

2425
/**
2526
* @package App\Doctrine\DBAL\Types
@@ -89,7 +90,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): DatabaseE
8990
return $enum;
9091
}
9192

92-
throw ConversionException::conversionFailedFormat(
93+
throw InvalidFormat::new(
9394
gettype($value),
9495
static::$name,
9596
'One of: "' . implode('", "', static::getValues()) . '"',

src/Doctrine/DBAL/Types/UTCDateTimeType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Platforms\AbstractPlatform;
1515
use Doctrine\DBAL\Types\ConversionException;
1616
use Doctrine\DBAL\Types\DateTimeType;
17+
use Doctrine\DBAL\Types\Exception\InvalidFormat;
1718
use Override;
1819

1920
/**
@@ -89,7 +90,7 @@ private function checkConvertedValue(string $value, AbstractPlatform $platform,
8990
return $converted;
9091
}
9192

92-
throw ConversionException::conversionFailedFormat(
93+
throw InvalidFormat::new(
9394
$value,
9495
self::lookupName($this),
9596
$platform->getDateTimeFormatString()

0 commit comments

Comments
 (0)