From f5ad8bd7f1a8bbbc80a5ef484a4ac4662c31e639 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 25 Jul 2024 17:11:28 +0200 Subject: [PATCH] Include ODM in description (#333) * include ODM in description * misc * fix namespace --- config/sets/typed-collections.php | 2 + docs/rector_rules_overview.md | 2 +- .../Fixture/ManyToMany/adder_param.php.inc | 4 +- .../adder_param_with_typehint_only.php.inc | 4 +- .../Fixture/ManyToMany/no_var.php.inc | 4 +- .../ManyToMany/no_var_attribute.php.inc | 4 +- .../ManyToMany/param_without_array.php.inc | 4 +- .../skip_collection_generic_class.php.inc | 2 +- .../skip_collection_generic_object.php.inc | 2 +- .../Fixture/ManyToMany/var_fixture.php.inc | 4 +- .../Fixture/ManyToMany/var_static.php.inc | 4 +- .../ManyToMany/var_without_array.php.inc | 4 +- .../ManyToMany/var_without_collection.php.inc | 4 +- .../Fixture/Odm/orm_many.php.inc | 50 +++++++++++++++++++ .../Fixture/OneToMany/adder_param.php.inc | 4 +- .../adder_param_with_typehint_only.php.inc | 4 +- .../Fixture/OneToMany/no_var.php.inc | 4 +- .../OneToMany/no_var_attribute.php.inc | 4 +- .../OneToMany/param_without_array.php.inc | 4 +- .../skip_collection_generic_class.php.inc | 2 +- .../skip_collection_generic_object.php.inc | 2 +- .../Fixture/OneToMany/var_fixture.php.inc | 4 +- .../Fixture/OneToMany/var_static.php.inc | 4 +- .../OneToMany/var_without_array.php.inc | 4 +- .../OneToMany/var_without_collection.php.inc | 4 +- .../ExplicitRelationCollectionRector.php | 18 ++++--- 26 files changed, 104 insertions(+), 48 deletions(-) create mode 100644 rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/Odm/orm_many.php.inc diff --git a/config/sets/typed-collections.php b/config/sets/typed-collections.php index 466a446b..63663a72 100644 --- a/config/sets/typed-collections.php +++ b/config/sets/typed-collections.php @@ -5,9 +5,11 @@ use Rector\Config\RectorConfig; use Rector\Doctrine\CodeQuality\Rector\Class_\AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector; use Rector\Doctrine\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector; +use Rector\Doctrine\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector; return RectorConfig::configure() ->withRules([ ExplicitRelationCollectionRector::class, AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector::class, + ImproveDoctrineCollectionDocTypeInEntityRector::class, ]); diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index 661868dc..d5b7a3e4 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -120,7 +120,7 @@ Replace EventSubscriberInterface with AsDoctrineListener attribute(s) ## ExplicitRelationCollectionRector -Use explicit collection in one-to-many relations of Doctrine entity +Use Collection object type for one-to-many relations of Doctrine entity/ODM document - class: [`Rector\Doctrine\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector`](../rules/CodeQuality/Rector/Class_/ExplicitRelationCollectionRector.php) diff --git a/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/ManyToMany/adder_param.php.inc b/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/ManyToMany/adder_param.php.inc index 66490ad5..25e6fb4f 100644 --- a/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/ManyToMany/adder_param.php.inc +++ b/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/ManyToMany/adder_param.php.inc @@ -1,6 +1,6 @@ items; + } +} + +?> +----- + + */ + private $items = []; + + public function getItems() + { + return $this->items; + } +} + +?> diff --git a/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/OneToMany/adder_param.php.inc b/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/OneToMany/adder_param.php.inc index 3c3f7080..a19e8ea3 100644 --- a/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/OneToMany/adder_param.php.inc +++ b/rules-tests/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector/Fixture/OneToMany/adder_param.php.inc @@ -1,6 +1,6 @@