Skip to content

Commit b0b86b1

Browse files
committed
require PropertyInfo 8.0+ in the Doctrine bridge
1 parent 5fad6de commit b0b86b1

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"symfony/lock": "^7.4|^8.0",
4141
"symfony/messenger": "^7.4|^8.0",
4242
"symfony/property-access": "^7.4|^8.0",
43-
"symfony/property-info": "^7.4|^8.0",
43+
"symfony/property-info": "^8.0",
4444
"symfony/security-core": "^7.4|^8.0",
4545
"symfony/stopwatch": "^7.4|^8.0",
4646
"symfony/translation": "^7.4|^8.0",
@@ -53,7 +53,8 @@
5353
"doctrine/collections": "<1.8",
5454
"doctrine/dbal": "<3.6",
5555
"doctrine/lexer": "<1.1",
56-
"doctrine/orm": "<2.15"
56+
"doctrine/orm": "<2.15",
57+
"symfony/property-info": "<8.0"
5758
},
5859
"autoload": {
5960
"psr-4": { "Symfony\\Bridge\\Doctrine\\": "" },

src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
1616
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
1717
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
18+
use Symfony\Component\PropertyInfo\Type as LegacyType;
1819
use Symfony\Component\TypeInfo\Type;
1920
use Symfony\Component\Validator\Constraints\All;
2021
use Symfony\Component\Validator\Constraints\Iban;
@@ -61,6 +62,7 @@ public function testLoadClassMetadata()
6162
private int $i = 0;
6263
private int $j = 0;
6364
private array $types;
65+
private array $legacyTypes;
6466

6567
public function getType(string $class, string $property, array $context = []): ?Type
6668
{
@@ -84,6 +86,29 @@ public function getType(string $class, string $property, array $context = []): ?
8486

8587
return $type;
8688
}
89+
90+
public function getTypes(string $class, string $property, array $context = []): ?array
91+
{
92+
$this->legacyTypes ??= [
93+
[new LegacyType('string', true)],
94+
[new LegacyType('string')],
95+
[new LegacyType('string', true), new LegacyType('int'), new LegacyType('bool')],
96+
[new LegacyType('object', true, Entity::class)],
97+
[new LegacyType('array', true, null, true, null, new LegacyType('object', false, Entity::class))],
98+
[new LegacyType('array', true, null, true)],
99+
[new LegacyType('float', true)], // The existing constraint is float
100+
[new LegacyType('string', true)],
101+
[new LegacyType('string', true)],
102+
[new LegacyType('array', true, null, true, null, new LegacyType('float'))],
103+
[new LegacyType('string')],
104+
[new LegacyType('string')],
105+
];
106+
107+
$legacyType = $this->legacyTypes[$this->j];
108+
++$this->j;
109+
110+
return $legacyType;
111+
}
87112
};
88113

89114
$propertyAccessExtractor = $this->createMock(PropertyAccessExtractorInterface::class);
@@ -215,6 +240,11 @@ public function getType(string $class, string $property, array $context = []): ?
215240
{
216241
return Type::string();
217242
}
243+
244+
public function getTypes(string $class, string $property, array $context = []): ?array
245+
{
246+
return [new LegacyType('string')];
247+
}
218248
};
219249

220250
$propertyAccessExtractor = $this->createMock(PropertyAccessExtractorInterface::class);
@@ -249,6 +279,11 @@ public function getType(string $class, string $property, array $context = []): ?
249279
{
250280
return Type::string();
251281
}
282+
283+
public function getTypes(string $class, string $property, array $context = []): ?array
284+
{
285+
return [new LegacyType('string')];
286+
}
252287
};
253288
}
254289

0 commit comments

Comments
 (0)