File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
tests/AutoMapperTest/ArraySourcePropertyType Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ public static function fromEvent(SourcePropertyMetadataEvent $metadata): self
3838 $ metadata ->checkExists ?? false ,
3939 $ metadata ->groups ,
4040 $ metadata ->dateTimeFormat ?? \DateTimeInterface::RFC3339 ,
41+ $ metadata ->type
4142 );
4243 }
4344
Original file line number Diff line number Diff line change 1+ AutoMapper\Tests\AutoMapperTest\ArraySourcePropertyType\Dto {
2+ +age: [
3+ 10.0
4+ ]
5+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace AutoMapper \Tests \AutoMapperTest \ArraySourcePropertyType ;
6+
7+ use AutoMapper \Attribute \MapFrom ;
8+ use AutoMapper \Tests \AutoMapperBuilder ;
9+
10+ class Dto
11+ {
12+ /** @var array<float> */
13+ #[MapFrom(source: 'array ' , sourcePropertyType: 'array<string> ' )]
14+ public array $ age ;
15+ }
16+
17+ return (function () {
18+ $ autoMapper = AutoMapperBuilder::buildAutoMapper ();
19+
20+ yield $ autoMapper ->map (['age ' => ['10 ' ]], Dto::class);
21+ })();
You can’t perform that action at this time.
0 commit comments