@@ -117,17 +117,25 @@ public function testTestGetPropertiesWithEmbedded()
117
117
#[IgnoreDeprecations]
118
118
#[Group('legacy ' )]
119
119
#[DataProvider('legacyTypesProvider ' )]
120
- public function testExtractLegacy (string $ property , ?array $ type = null )
120
+ public function testExtractLegacy (string $ property , ?callable $ typeFactory = null )
121
121
{
122
+ if (!class_exists (LegacyType::class)) {
123
+ $ this ->markTestSkipped ('This test requires symfony/property-info < 8.0. ' );
124
+ }
125
+
122
126
$ this ->expectUserDeprecationMessage ('Since symfony/property-info 7.3: The "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getTypes()" method is deprecated, use "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getType()" instead. ' );
123
127
124
- $ this ->assertEquals ($ type , $ this ->createExtractor ()->getTypes (DoctrineDummy::class, $ property , []));
128
+ $ this ->assertEquals (null !== $ typeFactory ? $ typeFactory () : null , $ this ->createExtractor ()->getTypes (DoctrineDummy::class, $ property , []));
125
129
}
126
130
127
131
#[IgnoreDeprecations]
128
132
#[Group('legacy ' )]
129
133
public function testExtractWithEmbeddedLegacy ()
130
134
{
135
+ if (!class_exists (LegacyType::class)) {
136
+ $ this ->markTestSkipped ('This test requires symfony/property-info < 8.0. ' );
137
+ }
138
+
131
139
$ this ->expectUserDeprecationMessage ('Since symfony/property-info 7.3: The "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getTypes()" method is deprecated, use "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getType()" instead. ' );
132
140
133
141
$ expectedTypes = [new LegacyType (
@@ -149,6 +157,10 @@ public function testExtractWithEmbeddedLegacy()
149
157
#[Group('legacy ' )]
150
158
public function testExtractEnumLegacy ()
151
159
{
160
+ if (!class_exists (LegacyType::class)) {
161
+ $ this ->markTestSkipped ('This test requires symfony/property-info < 8.0. ' );
162
+ }
163
+
152
164
$ this ->expectUserDeprecationMessage ('Since symfony/property-info 7.3: The "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getTypes()" method is deprecated, use "Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor::getType()" instead. ' );
153
165
154
166
$ this ->assertEquals ([new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , EnumString::class)], $ this ->createExtractor ()->getTypes (DoctrineEnum::class, 'enumString ' , []));
@@ -164,68 +176,68 @@ public static function legacyTypesProvider(): array
164
176
{
165
177
// DBAL 4 has a special fallback strategy for BINGINT (int -> string)
166
178
if (!method_exists (BigIntType::class, 'getName ' )) {
167
- $ expectedBingIntType = [new LegacyType (LegacyType::BUILTIN_TYPE_INT ), new LegacyType (LegacyType::BUILTIN_TYPE_STRING )];
179
+ $ expectedBingIntType = fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_INT ), new LegacyType (LegacyType::BUILTIN_TYPE_STRING )];
168
180
} else {
169
- $ expectedBingIntType = [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )];
181
+ $ expectedBingIntType = fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )];
170
182
}
171
183
172
184
return [
173
- ['id ' , [new LegacyType (LegacyType::BUILTIN_TYPE_INT )]],
174
- ['guid ' , [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )]],
185
+ ['id ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_INT )]],
186
+ ['guid ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )]],
175
187
['bigint ' , $ expectedBingIntType ],
176
- ['time ' , [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateTime ' )]],
177
- ['timeImmutable ' , [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateTimeImmutable ' )]],
178
- ['dateInterval ' , [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateInterval ' )]],
179
- ['float ' , [new LegacyType (LegacyType::BUILTIN_TYPE_FLOAT )]],
180
- ['decimal ' , [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )]],
181
- ['bool ' , [new LegacyType (LegacyType::BUILTIN_TYPE_BOOL )]],
182
- ['binary ' , [new LegacyType (LegacyType::BUILTIN_TYPE_RESOURCE )]],
183
- ['jsonArray ' , [new LegacyType (LegacyType::BUILTIN_TYPE_ARRAY , false , null , true )]],
184
- ['foo ' , [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , true , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )]],
185
- ['bar ' , [new LegacyType (
188
+ ['time ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateTime ' )]],
189
+ ['timeImmutable ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateTimeImmutable ' )]],
190
+ ['dateInterval ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'DateInterval ' )]],
191
+ ['float ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_FLOAT )]],
192
+ ['decimal ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_STRING )]],
193
+ ['bool ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_BOOL )]],
194
+ ['binary ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_RESOURCE )]],
195
+ ['jsonArray ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_ARRAY , false , null , true )]],
196
+ ['foo ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , true , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )]],
197
+ ['bar ' , fn () => [new LegacyType (
186
198
LegacyType::BUILTIN_TYPE_OBJECT ,
187
199
false ,
188
200
'Doctrine\Common\Collections\Collection ' ,
189
201
true ,
190
202
new LegacyType (LegacyType::BUILTIN_TYPE_INT ),
191
203
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )
192
204
)]],
193
- ['indexedRguid ' , [new LegacyType (
205
+ ['indexedRguid ' , fn () => [new LegacyType (
194
206
LegacyType::BUILTIN_TYPE_OBJECT ,
195
207
false ,
196
208
'Doctrine\Common\Collections\Collection ' ,
197
209
true ,
198
210
new LegacyType (LegacyType::BUILTIN_TYPE_STRING ),
199
211
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )
200
212
)]],
201
- ['indexedBar ' , [new LegacyType (
213
+ ['indexedBar ' , fn () => [new LegacyType (
202
214
LegacyType::BUILTIN_TYPE_OBJECT ,
203
215
false ,
204
216
'Doctrine\Common\Collections\Collection ' ,
205
217
true ,
206
218
new LegacyType (LegacyType::BUILTIN_TYPE_STRING ),
207
219
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )
208
220
)]],
209
- ['indexedFoo ' , [new LegacyType (
221
+ ['indexedFoo ' , fn () => [new LegacyType (
210
222
LegacyType::BUILTIN_TYPE_OBJECT ,
211
223
false ,
212
224
'Doctrine\Common\Collections\Collection ' ,
213
225
true ,
214
226
new LegacyType (LegacyType::BUILTIN_TYPE_STRING ),
215
227
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation ' )
216
228
)]],
217
- ['indexedBaz ' , [new LegacyType (
229
+ ['indexedBaz ' , fn () => [new LegacyType (
218
230
LegacyType::BUILTIN_TYPE_OBJECT ,
219
231
false ,
220
232
Collection::class,
221
233
true ,
222
234
new LegacyType (LegacyType::BUILTIN_TYPE_INT ),
223
235
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , DoctrineRelation::class)
224
236
)]],
225
- ['simpleArray ' , [new LegacyType (LegacyType::BUILTIN_TYPE_ARRAY , false , null , true , new LegacyType (LegacyType::BUILTIN_TYPE_INT ), new LegacyType (LegacyType::BUILTIN_TYPE_STRING ))]],
237
+ ['simpleArray ' , fn () => [new LegacyType (LegacyType::BUILTIN_TYPE_ARRAY , false , null , true , new LegacyType (LegacyType::BUILTIN_TYPE_INT ), new LegacyType (LegacyType::BUILTIN_TYPE_STRING ))]],
226
238
['customFoo ' , null ],
227
239
['notMapped ' , null ],
228
- ['indexedByDt ' , [new LegacyType (
240
+ ['indexedByDt ' , fn () => [new LegacyType (
229
241
LegacyType::BUILTIN_TYPE_OBJECT ,
230
242
false ,
231
243
Collection::class,
@@ -234,15 +246,15 @@ public static function legacyTypesProvider(): array
234
246
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , DoctrineRelation::class)
235
247
)]],
236
248
['indexedByCustomType ' , null ],
237
- ['indexedBuz ' , [new LegacyType (
249
+ ['indexedBuz ' , fn () => [new LegacyType (
238
250
LegacyType::BUILTIN_TYPE_OBJECT ,
239
251
false ,
240
252
Collection::class,
241
253
true ,
242
254
new LegacyType (LegacyType::BUILTIN_TYPE_STRING ),
243
255
new LegacyType (LegacyType::BUILTIN_TYPE_OBJECT , false , DoctrineRelation::class)
244
256
)]],
245
- ['dummyGeneratedValueList ' , [new LegacyType (
257
+ ['dummyGeneratedValueList ' , fn () => [new LegacyType (
246
258
LegacyType::BUILTIN_TYPE_OBJECT ,
247
259
false ,
248
260
'Doctrine\Common\Collections\Collection ' ,
0 commit comments