Skip to content

Commit 187cc9b

Browse files
committed
apply review suggestions
1 parent eee2339 commit 187cc9b

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ CHANGELOG
55
---
66

77
* Reset the manager registry using native lazy objects when applicable
8+
* Add support for `Symfony\Component\Clock\DatePoint` as `DatePointType` Doctrine type
89

910
7.2
1011
---
1112

1213
* Accept `ReadableCollection` in `CollectionToArrayTransformer`
13-
* Add support for `Symfony\Component\Clock\DatePoint` as `DatePointType` Doctrine type
1414

1515
7.1
1616
---

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterDatePointTypePass.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ public function process(ContainerBuilder $container): void
2828
return;
2929
}
3030

31-
$typeDefinition = $container->getParameter('doctrine.dbal.connection_factory.types');
31+
$types = $container->getParameter('doctrine.dbal.connection_factory.types');
3232

33-
if (is_array($typeDefinition) && !isset($typeDefinition['date_point'])) {
34-
$typeDefinition['date_point'] = ['class' => DatePointType::class];
35-
}
33+
$types['date_point'] ??= ['class' => DatePointType::class];
3634

37-
$container->setParameter('doctrine.dbal.connection_factory.types', $typeDefinition);
35+
$container->setParameter('doctrine.dbal.connection_factory.types', $types);
3836
}
3937
}

src/Symfony/Bridge/Doctrine/Tests/Types/DatePointTypeTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\Types;
1313

14-
use DateTimeImmutable;
1514
use Doctrine\DBAL\Platforms\AbstractPlatform;
1615
use Doctrine\DBAL\Platforms\MariaDBPlatform;
1716
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
@@ -72,7 +71,7 @@ public function testNullConvertsToPHPValue()
7271
public function testDateTimeImmutableConvertsToPHPValue()
7372
{
7473
$format = 'Y-m-d H:i:s';
75-
$dateTime = new DateTimeImmutable('2025-03-03 12:13:14');
74+
$dateTime = new \DateTimeImmutable('2025-03-03 12:13:14');
7675
$actual = $this->type->convertToPHPValue($dateTime, new SqlitePlatform());
7776
$expected = DatePoint::createFromInterface($dateTime);
7877

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Types;
1313

14-
use DateTimeInterface;
1514
use Doctrine\DBAL\Platforms\AbstractPlatform;
1615
use Doctrine\DBAL\Types\DateTimeImmutableType;
1716
use Symfony\Component\Clock\DatePoint;

0 commit comments

Comments
 (0)