1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Tests\Fixtures; 6 7use JMS\Serializer\Annotation\Type; 8use JMS\Serializer\Annotation\XmlKeyValuePairs; 9 10class ObjectWithXmlKeyValuePairsWithType 11{ 12 /** 13 * @var array 14 * @Type("array<string,string>") 15 * @XmlKeyValuePairs 16 */ 17 private $list; 18 19 /** 20 * @var array 21 * @Type("array<string>") 22 */ 23 private $list2; 24 25 public function __construct(array $list, array $list2 = []) 26 { 27 $this->list = $list; 28 $this->list2 = $list2; 29 } 30 31 public static function create1() 32 { 33 return new self( 34 [ 35 'key-one' => 'foo', 36 'key-two' => 'bar', 37 ] 38 ); 39 } 40 41 public static function create2() 42 { 43 return new self( 44 [ 45 'key_01' => 'One', 46 'key_02' => 'Two', 47 'key_03' => 'Three', 48 ], 49 ['Four'] 50 ); 51 } 52} 53