diff --git a/src/Extractor/WriteMutator.php b/src/Extractor/WriteMutator.php index 075bc13..deffb03 100644 --- a/src/Extractor/WriteMutator.php +++ b/src/Extractor/WriteMutator.php @@ -161,7 +161,7 @@ public function getTypes(string $target): ?array $reflectionMethod->getDocComment(), $target, $reflectionMethod->getDeclaringClass()->getName(), - $this->property, + $reflectionMethod->getParameters()[0]->name, '@param' )) { return $types; diff --git a/tests/AutoMapperTest/Issue269/expected.data b/tests/AutoMapperTest/Issue269/expected.data new file mode 100644 index 0000000..093df19 --- /dev/null +++ b/tests/AutoMapperTest/Issue269/expected.data @@ -0,0 +1,8 @@ +AutoMapper\Tests\AutoMapperTest\Issue269\Entity { + -paymentMethods: [ + AutoMapper\Tests\AutoMapperTest\Issue269\PaymentMethod { + +name: "First" + +value: "First" + } + ] +} diff --git a/tests/AutoMapperTest/Issue269/map.php b/tests/AutoMapperTest/Issue269/map.php new file mode 100644 index 0000000..15e85de --- /dev/null +++ b/tests/AutoMapperTest/Issue269/map.php @@ -0,0 +1,43 @@ +paymentMethods = $paymentMethods; + + return $this; + } + + /** @return PaymentMethod[] */ + public function getPaymentMethods(): array + { + return $this->paymentMethods; + } +} + +$dto = new Dto(); +$dto->paymentMethods = [PaymentMethod::First]; + +return AutoMapperBuilder::buildAutoMapper()->map($dto, Entity::class);