From 4ce5d8e75a0cb8ec6dfb543f2c655733e88bc940 Mon Sep 17 00:00:00 2001 From: Mathias Arlaud Date: Tue, 24 Sep 2024 10:07:19 +0200 Subject: [PATCH] [PropertyInfo] Fix bigint extraction with type info --- src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php | 2 +- .../Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php index cf32c6c537b02..478fbfbe8e251 100644 --- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php +++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php @@ -133,7 +133,7 @@ public function getType(string $class, string $property, array $context = []): ? // DBAL 4 has a special fallback strategy for BINGINT (int -> string) if (Types::BIGINT === $typeOfField && !method_exists(BigIntType::class, 'getName')) { - return Type::collection(Type::int(), Type::string()); + return $nullable ? Type::nullable(Type::union(Type::int(), Type::string())) : Type::union(Type::int(), Type::string()); } $enumType = null; diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php index 90cd6b97b9237..7903da227e912 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -286,7 +286,7 @@ public static function typeProvider(): iterable { // DBAL 4 has a special fallback strategy for BINGINT (int -> string) if (!method_exists(BigIntType::class, 'getName')) { - $expectedBigIntType = Type::collection(Type::int(), Type::string()); + $expectedBigIntType = Type::union(Type::int(), Type::string()); } else { $expectedBigIntType = Type::string(); }