File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
tests/AutoMapperTest/ArrayNested Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ private function isObjectType(Type $type): bool
4747 return false ;
4848 }
4949
50- if (Type::BUILTIN_TYPE_ARRAY === $ type ->getBuiltinType () && $ type ->isCollection ()) {
50+ if (Type::BUILTIN_TYPE_ARRAY === $ type ->getBuiltinType () && $ type ->isCollection () && $ type -> getCollectionValueTypes () ) {
5151 return false ;
5252 }
5353
Original file line number Diff line number Diff line change 1+ AutoMapper\Tests\AutoMapperTest\ArrayNested\TestTarget {
2+ -endpoints: AutoMapper\Tests\AutoMapperTest\ArrayNested\TestSubTarget {
3+ -endpoint: "https://example.com"
4+ -params: [
5+ "param1"
6+ "param2"
7+ ]
8+ }
9+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace AutoMapper \Tests \AutoMapperTest \ArrayNested ;
6+
7+ use AutoMapper \Tests \AutoMapperBuilder ;
8+
9+ class ClassContainer
10+ {
11+ public ?array $ endpoints = null ;
12+ }
13+
14+ class TestSubTarget
15+ {
16+ public function __construct (
17+ private ?string $ endpoint = null ,
18+ private ?array $ params = null ,
19+ ) {
20+ }
21+ }
22+
23+ class TestTarget
24+ {
25+ public function __construct (
26+ private ?TestSubTarget $ endpoints = null ,
27+ ) {
28+ }
29+ }
30+
31+ return (function () {
32+ $ autoMapper = AutoMapperBuilder::buildAutoMapper ();
33+
34+ $ classContainer = new ClassContainer ();
35+ $ classContainer ->endpoints = [
36+ 'endpoint ' => 'https://example.com ' ,
37+ 'params ' => ['param1 ' , 'param2 ' ],
38+ ];
39+
40+ yield 'array ' => $ autoMapper ->map ($ classContainer , TestTarget::class);
41+ })();
You can’t perform that action at this time.
0 commit comments