@@ -1129,6 +1129,24 @@ public function testNormalizationWithMaxDepthOnStdclassObjectDoesNotThrowWarning
1129
1129
1130
1130
$ this ->assertSame (['string ' => 'yes ' ], $ normalized );
1131
1131
}
1132
+
1133
+ public function testDenormalizeCollectionOfScalarTypesPropertyWithPhpDocExtractor ()
1134
+ {
1135
+ $ normalizer = new AbstractObjectNormalizerWithMetadataAndPhpDocExtractor ();
1136
+ $ data = [
1137
+ 'type ' => 'foo ' ,
1138
+ 'values ' => [
1139
+ ['1 ' ],
1140
+ ['2 ' ],
1141
+ ['3 ' ],
1142
+ ['4 ' ],
1143
+ ['5 ' ],
1144
+ ],
1145
+ ];
1146
+ $ expected = new ScalarCollectionDocBlockDummy ([[1 ], [2 ], [3 ], [4 ], [5 ]]);
1147
+
1148
+ $ this ->assertEquals ($ expected , $ normalizer ->denormalize ($ data , ScalarCollectionDocBlockDummy::class));
1149
+ }
1132
1150
}
1133
1151
1134
1152
class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer
@@ -1540,3 +1558,44 @@ public function __construct(
1540
1558
) {
1541
1559
}
1542
1560
}
1561
+
1562
+ #[DiscriminatorMap('type ' , ['foo ' => ScalarCollectionDocBlockDummy::class])]
1563
+ class ScalarCollectionDocBlockDummy
1564
+ {
1565
+ /**
1566
+ * @param array<int, array<int, string>>|null $values
1567
+ */
1568
+ public function __construct (
1569
+ private readonly ?array $ values = null ,
1570
+ ) {
1571
+ }
1572
+ /** @return array<int, array<int, string>>|null */
1573
+ public function getValues (): ?array
1574
+ {
1575
+ return $ this ->values ;
1576
+ }
1577
+ }
1578
+
1579
+ class AbstractObjectNormalizerWithMetadataAndPhpDocExtractor extends AbstractObjectNormalizer
1580
+ {
1581
+ public function __construct ()
1582
+ {
1583
+ parent ::__construct (new ClassMetadataFactory (new AttributeLoader ()), null , new PropertyInfoExtractor ([], [new PhpDocExtractor ()]));
1584
+ }
1585
+
1586
+ protected function extractAttributes (object $ object , ?string $ format = null , array $ context = []): array
1587
+ {
1588
+ }
1589
+
1590
+ protected function getAttributeValue (object $ object , string $ attribute , ?string $ format = null , array $ context = []): mixed
1591
+ {
1592
+ }
1593
+
1594
+ protected function setAttributeValue (object $ object , string $ attribute , mixed $ value , ?string $ format = null , array $ context = []): void
1595
+ {
1596
+ }
1597
+
1598
+ public function getSupportedTypes (?string $ format ): array
1599
+ {
1600
+ }
1601
+ }
0 commit comments