@@ -1129,6 +1129,24 @@ public function testNormalizationWithMaxDepthOnStdclassObjectDoesNotThrowWarning
11291129
11301130 $ this ->assertSame (['string ' => 'yes ' ], $ normalized );
11311131 }
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+ }
11321150}
11331151
11341152class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer
@@ -1540,3 +1558,45 @@ public function __construct(
15401558 ) {
15411559 }
15421560}
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+
1573+ /** @return array<int, array<int, string>>|null */
1574+ public function getValues (): ?array
1575+ {
1576+ return $ this ->values ;
1577+ }
1578+ }
1579+
1580+ class AbstractObjectNormalizerWithMetadataAndPhpDocExtractor extends AbstractObjectNormalizer
1581+ {
1582+ public function __construct ()
1583+ {
1584+ parent ::__construct (new ClassMetadataFactory (new AttributeLoader ()), null , new PropertyInfoExtractor ([], [new PhpDocExtractor ()]));
1585+ }
1586+
1587+ protected function extractAttributes (object $ object , ?string $ format = null , array $ context = []): array
1588+ {
1589+ }
1590+
1591+ protected function getAttributeValue (object $ object , string $ attribute , ?string $ format = null , array $ context = []): mixed
1592+ {
1593+ }
1594+
1595+ protected function setAttributeValue (object $ object , string $ attribute , mixed $ value , ?string $ format = null , array $ context = []): void
1596+ {
1597+ }
1598+
1599+ public function getSupportedTypes (?string $ format ): array
1600+ {
1601+ }
1602+ }
0 commit comments