8000 simplify conversion · symfony/symfony@a831c3a · GitHub
[go: up one dir, main page]

Skip to content

Commit a831c3a

Browse files
committed
simplify conversion
1 parent 7a05df7 commit a831c3a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Bridge/Doctrine/Types/DatePointType.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use DateTimeInterface;
1515
use Doctrine\DBAL\Platforms\AbstractPlatform;
16-
use Doctrine\DBAL\Types\ConversionException;
1716
use Doctrine\DBAL\Types\DateTimeImmutableType;
1817
use Symfony\Component\Clock\DatePoint;
1918

@@ -28,11 +27,11 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da
2827
}
2928

3029
$value = parent::convertToPHPValue($value, $platform);
31-
if ($value instanceof DateTimeInterface) {
32-
return DatePoint::createFromInterface($value);
30+
if (null === $value) {
31+
return null;
3332
}
3433

35-
throw new ConversionException();
34+
return DatePoint::createFromInterface($value);
3635
}
3736

3837
public function getName(): string

0 commit comments

Comments
 (0)
0