File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
tests/AutoMapperTest/ConstructorWithSerializedName Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ [
2+ "is_static" => true
3+ ]
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace AutoMapper \Tests \AutoMapperTest \ConstructorWithSerializedName ;
6+
7+ use AutoMapper \Tests \AutoMapperBuilder ;
8+ use Symfony \Component \Serializer \Attribute \SerializedName ;
9+
10+ final readonly class Bar
11+ {
12+ public function __construct (
13+ #[SerializedName('is_static ' )]
14+ public bool $ isStatic
15+ ) {
16+ }
17+ }
18+
19+ $ autoMapper = AutoMapperBuilder::buildAutoMapper ();
20+
21+
22+ return (function () {
23+ $ autoMapper = AutoMapperBuilder::buildAutoMapper ();
24+
25+ yield 'to_array ' => $ autoMapper ->map (new Bar (true ), 'array ' );
26+
27+ yield 'from_array ' => $ autoMapper ->map (['is_static ' => true ], Bar::class);
28+ })();
You can’t perform that action at this time.
0 commit comments