From 001b5fa9300db5637460cbb9470f68e576a34d33 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 15 Feb 2024 15:31:59 +0100 Subject: [PATCH] add fixture --- .../Fixture/id_mapping_constructor.php.inc | 31 +++++++++++++++++++ .../config/yaml_mapping/id_mapping.yml | 7 +++++ .../ToManyRelationPropertyTypeResolver.php | 6 ++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/Fixture/id_mapping_constructor.php.inc diff --git a/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/Fixture/id_mapping_constructor.php.inc b/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/Fixture/id_mapping_constructor.php.inc new file mode 100644 index 00000000..33d6f3c4 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/Fixture/id_mapping_constructor.php.inc @@ -0,0 +1,31 @@ + +----- + diff --git a/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/config/yaml_mapping/id_mapping.yml b/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/config/yaml_mapping/id_mapping.yml index 3213fd98..1cafb0a2 100644 --- a/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/config/yaml_mapping/id_mapping.yml +++ b/rules-tests/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector/config/yaml_mapping/id_mapping.yml @@ -4,3 +4,10 @@ Rector\Doctrine\Tests\CodeQuality\Rector\Class_\YamlToAttributeDoctrineMappingRe type: integer generator: strategy: auto + +Rector\Doctrine\Tests\CodeQuality\Rector\Class_\YamlToAttributeDoctrineMappingRector\Fixture\IdMappingConstructor: + id: + id: + type: integer + generator: + strategy: auto diff --git a/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php b/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php index 5743e689..f30ae841 100644 --- a/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php +++ b/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php @@ -85,8 +85,10 @@ private function processToManyRelation( return $this->resolveTypeFromTargetEntity($targetEntityClass, $property); } - private function resolveTypeFromTargetEntity(Expr|string $targetEntity, Property $property): Type - { + private function resolveTypeFromTargetEntity( + Expr|string $targetEntity, + Property|\PhpParser\Node\Param $property + ): Type { if ($targetEntity instanceof Expr) { $targetEntity = $this->valueResolver->getValue($targetEntity); }