From 35cf4810c1707a005dca56c818c231f4a6ba4a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane?= Date: Fri, 27 Nov 2020 18:50:57 +0100 Subject: [PATCH 01/27] Add docs to export-ignore --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 2ad69e189f9..94bcaaa975b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ /tests export-ignore /tools export-ignore +/docs export-ignore /.github export-ignore .gitattributes export-ignore .gitignore export-ignore From 8724589c6e61aee77830b6637ae6961e65d4a402 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 6 Feb 2021 00:23:45 +0100 Subject: [PATCH 02/27] Housekeeping: Fix wrong typehint - Closes #8421 --- lib/Doctrine/ORM/LazyCriteriaCollection.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/LazyCriteriaCollection.php b/lib/Doctrine/ORM/LazyCriteriaCollection.php index 1cd64d83514..90c1c3edb3f 100644 --- a/lib/Doctrine/ORM/LazyCriteriaCollection.php +++ b/lib/Doctrine/ORM/LazyCriteriaCollection.php @@ -24,7 +24,6 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Selectable; -use Doctrine\ORM\Persisters\Entity\BasicEntityPersister; use Doctrine\ORM\Persisters\Entity\EntityPersister; /** @@ -35,7 +34,7 @@ */ class LazyCriteriaCollection extends AbstractLazyCollection implements Selectable { - /** @var BasicEntityPersister */ + /** @var EntityPersister */ protected $entityPersister; /** @var Criteria */ From 2693a93aeda87e48a847c6eecfa2f8b1dc1b1759 Mon Sep 17 00:00:00 2001 From: Julian Ullrich <39773285+jukisu23@users.noreply.github.com> Date: Sat, 6 Feb 2021 00:35:45 +0100 Subject: [PATCH 03/27] fixed entity generation for numeric values (#8434) * fixed entity generation for numeric values * fixed entity generation for numeric values Co-authored-by: julian --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index cdfe5ad0478..9d72c9fe1ac 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -1335,6 +1335,8 @@ protected function generateEntityFieldMappingProperties(ClassMetadataInfo $metad if (isset($fieldMapping['options']['default'])) { if ($fieldMapping['type'] === 'boolean' && $fieldMapping['options']['default'] === '1') { $defaultValue = ' = true'; + } elseif (($fieldMapping['type'] === 'integer' || $fieldMapping['type'] === 'float') && ! empty($fieldMapping['options']['default'])) { + $defaultValue = ' = ' . (string) $fieldMapping['options']['default']; } else { $defaultValue = ' = ' . var_export($fieldMapping['options']['default'], true); } From b06679cc14f943488c668a1ad3a74e1612d45483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 6 Feb 2021 09:49:40 +0100 Subject: [PATCH 04/27] Manually fix cs --- .../Doctrine/Tests/Models/CMS/CmsComment.php | 5 +- .../Tests/Models/Company/CompanyAuction.php | 5 +- .../Tests/Models/DDC117/DDC117Article.php | 12 +- .../Tests/Models/DDC117/DDC117Editor.php | 5 +- .../Tests/Models/DDC117/DDC117Reference.php | 22 ++- .../Tests/Models/DDC3346/DDC3346Article.php | 1 + .../Tests/Models/DDC3699/DDC3699Child.php | 5 +- .../Tests/Models/DDC3699/DDC3699Parent.php | 5 +- .../Models/DDC869/DDC869ChequePayment.php | 5 +- .../Models/DDC869/DDC869CreditCardPayment.php | 5 +- .../Tests/Models/DirectoryTree/Directory.php | 5 +- .../Tests/Models/DirectoryTree/File.php | 5 +- .../Models/Global/GlobalNamespaceModel.php | 5 +- .../Tests/Models/Navigation/NavCountry.php | 5 +- .../Tests/Models/Pagination/Company.php | 5 +- .../Tests/Models/Pagination/Department.php | 5 +- .../Doctrine/Tests/Models/Pagination/Logo.php | 5 +- .../Doctrine/Tests/Models/Pagination/User.php | 5 +- .../Tests/Models/Pagination/User1.php | 5 +- .../Tests/Models/Routing/RoutingLocation.php | 5 +- .../Models/Routing/RoutingRouteBooking.php | 5 +- tests/Doctrine/Tests/Models/Tweet/Tweet.php | 5 +- tests/Doctrine/Tests/Models/Tweet/User.php | 5 +- .../Doctrine/Tests/Models/Tweet/UserList.php | 5 +- .../Functional/ClassTableInheritanceTest2.php | 5 +- .../ORM/Functional/DefaultValuesTest.php | 10 +- .../ORM/Functional/LifecycleCallbackTest.php | 10 +- .../Functional/Locking/LockAgentWorker.php | 4 +- .../SequenceEmulatedIdentityStrategyTest.php | 5 +- .../ORM/Functional/Ticket/DDC1335Test.php | 5 +- .../ORM/Functional/Ticket/DDC199Test.php | 5 +- .../ORM/Functional/Ticket/DDC2175Test.php | 5 +- .../ORM/Functional/Ticket/DDC2182Test.php | 5 +- .../ORM/Functional/Ticket/DDC2256Test.php | 10 +- .../ORM/Functional/Ticket/DDC237Test.php | 15 +- .../ORM/Functional/Ticket/DDC2660Test.php | 5 +- .../ORM/Functional/Ticket/DDC2996Test.php | 5 +- .../ORM/Functional/Ticket/DDC345Test.php | 15 +- .../ORM/Functional/Ticket/DDC3644Test.php | 15 +- .../ORM/Functional/Ticket/DDC371Test.php | 10 +- .../ORM/Functional/Ticket/DDC493Test.php | 5 +- .../ORM/Functional/Ticket/DDC513Test.php | 5 +- .../ORM/Functional/Ticket/DDC599Test.php | 5 +- .../ORM/Functional/Ticket/DDC618Test.php | 5 +- .../ORM/Functional/Ticket/DDC6303Test.php | 5 +- .../ORM/Functional/Ticket/DDC6460Test.php | 5 +- .../ORM/Functional/Ticket/DDC656Test.php | 10 +- .../ORM/Functional/Ticket/DDC832Test.php | 10 +- .../ORM/Functional/Ticket/DDC881Test.php | 10 +- .../ORM/Functional/Ticket/GH6141Test.php | 5 +- .../ORM/Functional/Ticket/GH6531Test.php | 5 +- .../ORM/Functional/Ticket/GH6937Test.php | 15 +- .../Ticket/GH7496WithToIterableTest.php | 10 +- .../ORM/Functional/Ticket/GH7836Test.php | 5 +- .../ORM/Functional/Ticket/GH7864Test.php | 10 +- .../ORM/Functional/Ticket/GH7941Test.php | 5 +- .../Tests/ORM/Functional/ValueObjectsTest.php | 25 ++- .../ORM/Mapping/AnnotationDriverTest.php | 20 +- .../Mapping/BasicInheritanceMappingTest.php | 65 +++++-- .../ORM/Mapping/ClassMetadataFactoryTest.php | 95 ++++++---- .../DefaultRepositoryFactoryTest.php | 2 +- .../ORM/Tools/Console/MetadataFilterTest.php | 30 ++- .../ORM/Tools/ConvertDoctrine1SchemaTest.php | 5 +- .../AbstractClassMetadataExporterTest.php | 58 +++--- .../Pagination/CountOutputWalkerTest.php | 2 +- .../Tools/Pagination/PaginationTestCase.php | 173 +++++++++++++++--- .../Tools/Pagination/WhereInWalkerTest.php | 20 +- .../Tests/ORM/Tools/SchemaToolTest.php | 48 ++++- .../Tests/ORM/Tools/SchemaValidatorTest.php | 60 +++++- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 5 +- 70 files changed, 756 insertions(+), 236 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsComment.php b/tests/Doctrine/Tests/Models/CMS/CmsComment.php index 96c26734851..fd07a0e2e90 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsComment.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsComment.php @@ -18,7 +18,10 @@ class CmsComment public $id; /** @Column(type="string", length=255) */ public $topic; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $text; /** * @ManyToOne(targetEntity="CmsArticle", inversedBy="comments") diff --git a/tests/Doctrine/Tests/Models/Company/CompanyAuction.php b/tests/Doctrine/Tests/Models/Company/CompanyAuction.php index ddf04227457..6c017119333 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyAuction.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyAuction.php @@ -7,7 +7,10 @@ /** @Entity @Table(name="company_auctions") */ class CompanyAuction extends CompanyEvent { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $data; public function setData($data): void diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php index 0b85a9cfc2b..776c88d0459 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Article.php @@ -25,7 +25,7 @@ class DDC117Article private $title; /** - * @psalm-var ArrayCollection + * @psalm-var Collection * @OneToMany(targetEntity="DDC117Reference", mappedBy="source", cascade={"remove"}) */ private $references; @@ -37,7 +37,7 @@ class DDC117Article private $details; /** - * @psalm-var ArrayCollection + * @psalm-var Collection * @OneToMany(targetEntity="DDC117Translation", mappedBy="article", cascade={"persist", "remove"}) */ private $translations; @@ -80,17 +80,17 @@ public function addTranslation(string $language, string $title): void $this->translations[] = new DDC117Translation($this, $language, $title); } - public function getText() + public function getText(): string { return $this->details->getText(); } - public function getDetails() + public function getDetails(): DDC117ArticleDetails { return $this->details; } - public function getLinks() + public function getLinks(): Collection { return $this->links; } @@ -100,7 +100,7 @@ public function resetText(): void $this->details = null; } - public function getTranslations() + public function getTranslations(): Collection { return $this->translations; } diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php index 068d8c1ceda..0904f8cd916 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php @@ -14,7 +14,10 @@ class DDC117Editor /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php index a1bda503cd8..cfb162a91ff 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Reference.php @@ -12,6 +12,7 @@ class DDC117Reference { /** + * @var DDC117Article * @Id * @ManyToOne(targetEntity="DDC117Article", inversedBy="references") * @JoinColumn(name="source_id", referencedColumnName="article_id") @@ -19,19 +20,26 @@ class DDC117Reference private $source; /** + * @var DDC117Article * @Id * @ManyToOne(targetEntity="DDC117Article") * @JoinColumn(name="target_id", referencedColumnName="article_id") */ private $target; - /** @column(type="string") */ + /** + * @var string + * @column(type="string") + */ private $description; - /** @column(type="datetime") */ + /** + * @var DateTime + * @column(type="datetime") + */ private $created; - public function __construct($source, $target, $description) + public function __construct(DDC117Article $source, DDC117Article $target, string $description) { $source->addReference($this); $target->addReference($this); @@ -42,22 +50,22 @@ public function __construct($source, $target, $description) $this->created = new DateTime('now'); } - public function source() + public function source(): DDC117Article { return $this->source; } - public function target() + public function target(): DDC117Article { return $this->target; } - public function setDescription($desc): void + public function setDescription(string $desc): void { $this->description = $desc; } - public function getDescription() + public function getDescription(): string { return $this->description; } diff --git a/tests/Doctrine/Tests/Models/DDC3346/DDC3346Article.php b/tests/Doctrine/Tests/Models/DDC3346/DDC3346Article.php index 1e1b2c15642..6fc55da5c5a 100644 --- a/tests/Doctrine/Tests/Models/DDC3346/DDC3346Article.php +++ b/tests/Doctrine/Tests/Models/DDC3346/DDC3346Article.php @@ -11,6 +11,7 @@ class DDC3346Article { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php index 52939eadf14..ab787a8eed5 100644 --- a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php +++ b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php @@ -10,7 +10,10 @@ class DDC3699Child extends DDC3699Parent /** @Id @Column(type="integer") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $childField; /** @OneToOne(targetEntity="DDC3699RelationOne", inversedBy="child") */ diff --git a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Parent.php b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Parent.php index fed1247218c..4162763e7bd 100644 --- a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Parent.php +++ b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Parent.php @@ -7,6 +7,9 @@ /** @MappedSuperclass */ abstract class DDC3699Parent { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $parentField; } diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php index bec5402dc82..756934d9dbc 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869ChequePayment.php @@ -11,7 +11,10 @@ */ class DDC869ChequePayment extends DDC869Payment { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ protected $serialNumber; public static function loadMetadata(ClassMetadataInfo $metadata): void diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php index 0e070c9b67e..457b9a229d9 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869CreditCardPayment.php @@ -11,7 +11,10 @@ */ class DDC869CreditCardPayment extends DDC869Payment { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ protected $creditCardNumber; public static function loadMetadata(ClassMetadataInfo $metadata): void diff --git a/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php b/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php index afc333e846b..04054f5dd05 100644 --- a/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php +++ b/tests/Doctrine/Tests/Models/DirectoryTree/Directory.php @@ -9,7 +9,10 @@ */ class Directory extends AbstractContentItem { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ protected $path; public function setPath($path): void diff --git a/tests/Doctrine/Tests/Models/DirectoryTree/File.php b/tests/Doctrine/Tests/Models/DirectoryTree/File.php index 2b17e20e645..3fd5a665a1d 100644 --- a/tests/Doctrine/Tests/Models/DirectoryTree/File.php +++ b/tests/Doctrine/Tests/Models/DirectoryTree/File.php @@ -10,7 +10,10 @@ */ class File extends AbstractContentItem { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ protected $extension = 'html'; public function __construct(?Directory $parent = null) diff --git a/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php b/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php index 4063de1b63d..4712f8bbedb 100644 --- a/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php +++ b/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php @@ -14,7 +14,10 @@ class DoctrineGlobal_Article */ protected $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ protected $headline; /** @column(type="text") */ diff --git a/tests/Doctrine/Tests/Models/Navigation/NavCountry.php b/tests/Doctrine/Tests/Models/Navigation/NavCountry.php index 99fd67d8d38..32f427bf988 100644 --- a/tests/Doctrine/Tests/Models/Navigation/NavCountry.php +++ b/tests/Doctrine/Tests/Models/Navigation/NavCountry.php @@ -17,7 +17,10 @@ class NavCountry */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; /** @OneToMany(targetEntity="NavPointOfInterest", mappedBy="country") */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Company.php b/tests/Doctrine/Tests/Models/Pagination/Company.php index e6b1ea42c43..97fdac867d1 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Company.php +++ b/tests/Doctrine/Tests/Models/Pagination/Company.php @@ -18,7 +18,10 @@ class Company */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @Column(type="string", name="jurisdiction_code", nullable=true) */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Department.php b/tests/Doctrine/Tests/Models/Pagination/Department.php index 92f387694ec..e085ae5782e 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Department.php +++ b/tests/Doctrine/Tests/Models/Pagination/Department.php @@ -18,7 +18,10 @@ class Department */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @ManyToOne(targetEntity="Company", inversedBy="departments", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Logo.php b/tests/Doctrine/Tests/Models/Pagination/Logo.php index 1ef7ac8f84a..74a54dc526a 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Logo.php +++ b/tests/Doctrine/Tests/Models/Pagination/Logo.php @@ -19,7 +19,10 @@ class Logo */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $image; /** @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/Models/Pagination/User.php b/tests/Doctrine/Tests/Models/Pagination/User.php index 4351b141cd2..afb0b61df69 100644 --- a/tests/Doctrine/Tests/Models/Pagination/User.php +++ b/tests/Doctrine/Tests/Models/Pagination/User.php @@ -19,6 +19,9 @@ abstract class User */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; } diff --git a/tests/Doctrine/Tests/Models/Pagination/User1.php b/tests/Doctrine/Tests/Models/Pagination/User1.php index 19ec8a47b57..9f3cdb7e426 100644 --- a/tests/Doctrine/Tests/Models/Pagination/User1.php +++ b/tests/Doctrine/Tests/Models/Pagination/User1.php @@ -9,6 +9,9 @@ */ class User1 extends User { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $email; } diff --git a/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php b/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php index cdfb675312c..211795419d3 100644 --- a/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php +++ b/tests/Doctrine/Tests/Models/Routing/RoutingLocation.php @@ -15,7 +15,10 @@ class RoutingLocation */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function getName() diff --git a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php index 3ca39513a3c..cf33001823a 100644 --- a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php +++ b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php @@ -22,7 +22,10 @@ class RoutingRouteBooking */ public $route; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $passengerName = null; public function getPassengerName() diff --git a/tests/Doctrine/Tests/Models/Tweet/Tweet.php b/tests/Doctrine/Tests/Models/Tweet/Tweet.php index 2102a62ffca..2e644db67e5 100644 --- a/tests/Doctrine/Tests/Models/Tweet/Tweet.php +++ b/tests/Doctrine/Tests/Models/Tweet/Tweet.php @@ -17,7 +17,10 @@ class Tweet */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $content; /** @ManyToOne(targetEntity="User", inversedBy="tweets") */ diff --git a/tests/Doctrine/Tests/Models/Tweet/User.php b/tests/Doctrine/Tests/Models/Tweet/User.php index 490748e8786..b439d087ccf 100644 --- a/tests/Doctrine/Tests/Models/Tweet/User.php +++ b/tests/Doctrine/Tests/Models/Tweet/User.php @@ -19,7 +19,10 @@ class User */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="Tweet", mappedBy="author", cascade={"persist"}, fetch="EXTRA_LAZY") */ diff --git a/tests/Doctrine/Tests/Models/Tweet/UserList.php b/tests/Doctrine/Tests/Models/Tweet/UserList.php index 948912fd202..c78e7536e37 100644 --- a/tests/Doctrine/Tests/Models/Tweet/UserList.php +++ b/tests/Doctrine/Tests/Models/Tweet/UserList.php @@ -17,7 +17,10 @@ class UserList */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $listName; /** @ManyToOne(targetEntity="User", inversedBy="userLists") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index 5b58197dc6a..fbb5e088fe0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -121,7 +121,10 @@ public function setRelated($related): void */ class CTIChild extends CTIParent { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $data; public function getData() diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index 59563e702a3..09fc56d89dd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -101,9 +101,15 @@ class DefaultValueUser * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name = ''; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $type = 'Poweruser'; /** @OneToOne(targetEntity="DefaultValueAddress", mappedBy="user", cascade={"persist"}) */ public $address; diff --git a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php index 650718cb6a4..3450e89adcf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php @@ -414,9 +414,15 @@ class LifecycleCallbackTestUser { /** @Id @Column(type="integer") @GeneratedValue */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $value; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; public function getId() diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php b/tests/Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php index bd2fd6eb7d7..c1f11fdb7fa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/LockAgentWorker.php @@ -6,9 +6,11 @@ use Closure; use Doctrine\Common\Cache\ArrayCache; +use Doctrine\DBAL\Connection; use Doctrine\DBAL\Logging\EchoSQLLogger; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; use GearmanWorker; use InvalidArgumentException; @@ -106,7 +108,7 @@ protected function processWorkload($job) return $workload['fixture']; } - protected function createEntityManager($conn) + protected function createEntityManager(Connection $conn): EntityManagerInterface { $config = new Configuration(); $config->setProxyDir(__DIR__ . '/../../../Proxies'); diff --git a/tests/Doctrine/Tests/ORM/Functional/SequenceEmulatedIdentityStrategyTest.php b/tests/Doctrine/Tests/ORM/Functional/SequenceEmulatedIdentityStrategyTest.php index 1396315c72d..697821543e3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SequenceEmulatedIdentityStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SequenceEmulatedIdentityStrategyTest.php @@ -64,7 +64,10 @@ class SequenceEmulatedIdentityEntity /** @Id @Column(type="integer") @GeneratedValue(strategy="IDENTITY") */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $value; public function getId() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php index 1e692658274..7dbbcdb8810 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php @@ -167,7 +167,10 @@ class DDC1335User /** @Column(type="string", unique=true) */ public $email; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC1335Phone", mappedBy="user", cascade={"persist", "remove"}) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index 17350ed2cbf..0f8eaa6ee7c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -69,7 +69,10 @@ class DDC199ParentClass */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $parentData; /** @OneToMany(targetEntity="DDC199RelatedClass", mappedBy="parent") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php index 1cc73d5d7ee..08a8032be78 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php @@ -53,7 +53,10 @@ class DDC2175Entity /** @Id @GeneratedValue @Column(type="integer") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $field; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php index 589ff74c498..316bb576596 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php @@ -56,7 +56,10 @@ class DDC2182OptionParent */ class DDC2182OptionChild { - /** @Id @Column */ + /** + * @Id + * @Column + */ private $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php index 9ccf1963fde..115120b2363 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php @@ -79,7 +79,10 @@ class DDC2256User */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @@ -102,7 +105,10 @@ class DDC2256Group */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC2256User", mappedBy="group") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index dd2f2c9979d..11468c9cfeb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -75,7 +75,10 @@ class DDC237EntityX { /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; /** * @OneToOne(targetEntity="DDC237EntityY") @@ -90,7 +93,10 @@ class DDC237EntityY { /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; } @@ -99,7 +105,10 @@ class DDC237EntityZ { /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php index 94b332c746f..9383380ffc2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php @@ -106,7 +106,10 @@ class DDC2660CustomerOrder /** @Id @ManyToOne(targetEntity="DDC2660Customer") */ public $customer; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function __construct(DDC2660Product $product, DDC2660Customer $customer, $name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php index ff7c0acd58f..0f1fb31d37a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php @@ -60,7 +60,10 @@ class DDC2996UserPreference { /** @Id @GeneratedValue @Column(type="integer") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $value; /** @ManyToOne(targetEntity="DDC2996User") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php index bc45e5e4e1b..a8846b9d5ba 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php @@ -70,7 +70,10 @@ class DDC345User */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC345Membership", mappedBy="user", cascade={"persist"}) */ @@ -94,7 +97,10 @@ class DDC345Group */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC345Membership", mappedBy="group", cascade={"persist"}) */ @@ -134,7 +140,10 @@ class DDC345Membership */ public $group; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $state; /** @Column(type="datetime") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php index c4e835c4578..effcfbebdf9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php @@ -143,7 +143,10 @@ class DDC3644User */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC3644Address", mappedBy="user", orphanRemoval=true) */ @@ -193,7 +196,10 @@ class DDC3644Address */ public $user; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $address; public function __construct($address) @@ -217,7 +223,10 @@ abstract class DDC3644Animal */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function __construct($name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php index 999dcbd14d4..555845f361e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php @@ -63,7 +63,10 @@ class DDC371Child { /** @Id @Column(type="integer") @GeneratedValue */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; /** @ManyToOne(targetEntity="DDC371Parent", inversedBy="children") @JoinColumn(name="parentId") */ public $parent; @@ -74,7 +77,10 @@ class DDC371Parent { /** @Id @Column(type="integer") @GeneratedValue */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; /** @OneToMany(targetEntity="DDC371Child", mappedBy="parent") */ public $children; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php index b4e1bef14fc..25bd2150bd2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php @@ -71,6 +71,9 @@ class DDC493Contact * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php index 6bb34d95839..26a8063c720 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php @@ -73,6 +73,9 @@ class DDC513Price */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $data; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php index 0c6cc8275e3..190e917a2de 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php @@ -111,7 +111,10 @@ public function getChildren() */ class DDC599Subitem extends DDC599Item { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $elem; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php index c865e3ed331..e90534aa099 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php @@ -146,7 +146,10 @@ class DDC618Author */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="DDC618Book", mappedBy="author", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php index 3fb2a327f37..ff428768a5a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php @@ -104,7 +104,10 @@ abstract class DDC6303BaseClass /** @Entity @Table */ class DDC6303ChildA extends DDC6303BaseClass { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $originalData; public function __construct(string $id, $originalData) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php index e70d4aac443..588d4000aae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php @@ -77,7 +77,10 @@ public function testInlineEmbeddableProxyInitialization(): void */ class DDC6460Embeddable { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $field; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php index 2b1289767e7..bded1a37c43 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php @@ -54,10 +54,16 @@ public function testRecomputeSingleEntityChangeSet_PreservesFieldOrder(): void */ class DDC656Entity { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $type; /** @Id @Column(type="integer") @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php index d637678b2a9..e3fff4765d0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php @@ -158,7 +158,10 @@ class DDC832Like /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $word; /** @@ -185,7 +188,10 @@ class DDC832JoinedIndex /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php index 3188014e5c2..41e60253afa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php @@ -112,7 +112,10 @@ class DDC881User * @GeneratedValue(strategy="AUTO") */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; /** @OneToMany(targetEntity="DDC881PhoneNumber",mappedBy="id") */ private $phoneNumbers; @@ -143,7 +146,10 @@ class DDC881PhoneNumber * @ManyToOne(targetEntity="DDC881User",cascade={"all"}) */ private $user; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $phonenumber; /** @OneToMany(targetEntity="DDC881PhoneCall", mappedBy="phonenumber") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php index 17973b506a4..36c5f9b93e0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php @@ -163,7 +163,10 @@ abstract class GH6141Person */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function __construct(string $name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php index 81ddaedd63a..7529d5f2fbb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php @@ -126,7 +126,10 @@ class GH6531ArticleAttribute /** @Id @Column(type="string") */ public $attribute; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $value; public function __construct(string $name, string $value, GH6531Article $article) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php index d41e36a71ba..8099ac9698f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php @@ -95,7 +95,10 @@ abstract class GH6937Person /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; } @@ -104,7 +107,10 @@ abstract class GH6937Person */ abstract class GH6937Employee extends GH6937Person { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $phoneNumber; } @@ -113,6 +119,9 @@ abstract class GH6937Employee extends GH6937Person */ class GH6937Manager extends GH6937Employee { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $department; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php index b70aafeea00..1d91b41f359 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php @@ -58,7 +58,10 @@ class GH7496EntityA */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function __construct(int $id, string $name) @@ -79,7 +82,10 @@ class GH7496EntityB */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; public function __construct(int $id, $name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php index 7c913c3efc4..f1f8309324a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php @@ -121,7 +121,10 @@ class GH7836ChildEntity /** @Column(type="integer") */ public $position; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @ManyToOne(targetEntity=GH7836ParentEntity::class, inversedBy="children") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php index b8f9c030d85..e175aab2b4e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php @@ -66,7 +66,10 @@ class GH7864User /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @OneToMany(targetEntity="GH7864Tweet", mappedBy="user", fetch="EXTRA_LAZY") */ @@ -92,7 +95,10 @@ class GH7864Tweet /** @Id @Column(type="integer") @GeneratedValue */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $content; /** @ManyToOne(targetEntity="GH7864User", inversedBy="tweets") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php index ca6d4f5cbe6..78c3ca2b8f8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php @@ -84,7 +84,10 @@ class GH7941Product */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @Column(type="decimal") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php index 12ed8c0c2bd..38f77e62e5b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php @@ -360,7 +360,10 @@ class DDC93Person /** @Id @GeneratedValue @Column(type="integer") */ public $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; /** @Embedded(class="DDC93Address") */ @@ -439,11 +442,20 @@ public function __construct($name = null) */ class DDC93Address { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $street; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $zip; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $city; /** @Embedded(class = "DDC93Country") */ public $country; @@ -470,7 +482,10 @@ class DDC93Customer /** @Embeddable */ class DDC93ContactInfo { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $email; /** @Embedded(class = "DDC93Address") */ public $address; diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php index c9ad0f61cf6..78674adfb63 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -264,7 +264,10 @@ public function testAttributeOverridesMappingWithTrait(): void */ class ColumnWithoutType { - /** @Id @Column */ + /** + * @Id + * @Column + */ public $id; } @@ -345,7 +348,10 @@ class SuperEntity */ class MiddleMappedSuperclass extends SuperEntity { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; } @@ -354,7 +360,10 @@ class MiddleMappedSuperclass extends SuperEntity */ class ChildEntity extends MiddleMappedSuperclass { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $text; } @@ -384,6 +393,9 @@ class AnnotationSLC */ class AnnotationSLCFoo { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index e2b65261d82..21424b4476a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -216,16 +216,27 @@ public function testMappedSuperclassIndex(): void class TransientBaseClass { + /** @var mixed */ private $transient1; + + /** @var mixed */ private $transient2; } /** @Entity */ class EntitySubClass extends TransientBaseClass { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ private $id; - /** @Column(type="string") */ + + /** + * @var string + * @Column(type="string") + */ private $name; } @@ -234,7 +245,10 @@ class MappedSuperclassBase { /** @Column(type="integer") */ private $mapped1; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $mapped2; /** * @OneToOne(targetEntity="MappedSuperclassRelated1") @@ -252,7 +266,10 @@ class EntitySubClass2 extends MappedSuperclassBase { /** @Id @Column(type="integer") */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; } @@ -265,9 +282,15 @@ class EntitySubClass2 extends MappedSuperclassBase */ class MappedSuperclassBaseIndex { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $mapped1; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $mapped2; } @@ -276,7 +299,10 @@ class EntityIndexSubClass extends MappedSuperclassBaseIndex { /** @Id @Column(type="integer") */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $name; } @@ -303,35 +329,50 @@ abstract class HierarchyBase /** @MappedSuperclass */ abstract class HierarchyASuperclass extends HierarchyBase { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $a; } /** @Entity */ class HierarchyBEntity extends HierarchyBase { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $b; } /** @Entity */ class HierarchyC extends HierarchyBase { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $c; } /** @Entity */ class HierarchyD extends HierarchyASuperclass { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $d; } /** @Entity */ class HierarchyE extends HierarchyBEntity { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $e; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php index 2938ca16035..aea66c94027 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php @@ -46,14 +46,14 @@ class ClassMetadataFactoryTest extends OrmTestCase public function testGetMetadataForSingleClass(): void { $mockDriver = new MetadataDriverMock(); - $entityManager = $this->_createEntityManager($mockDriver); + $entityManager = $this->createEntityManager($mockDriver); $conn = $entityManager->getConnection(); $mockPlatform = $conn->getDatabasePlatform(); $mockPlatform->setPrefersSequences(true); $mockPlatform->setPrefersIdentityColumns(false); - $cm1 = $this->_createValidClassMetadata(); + $cm1 = $this->createValidClassMetadata(); // SUT $cmf = new ClassMetadataFactory(); @@ -78,12 +78,12 @@ public function testGetMetadataForSingleClass(): void $this->assertTrue($cmMap1->hasField('name')); } - public function testGetMetadataFor_ReturnsLoadedCustomIdGenerator(): void + public function testGetMetadataForReturnsLoadedCustomIdGenerator(): void { - $cm1 = $this->_createValidClassMetadata(); + $cm1 = $this->createValidClassMetadata(); $cm1->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM); $cm1->customGeneratorDefinition = ['class' => CustomIdGenerator::class]; - $cmf = $this->_createTestFactory(); + $cmf = $this->createTestFactory(); $cmf->setMetadataForClass($cm1->name, $cm1); $actual = $cmf->getMetadataFor($cm1->name); @@ -92,36 +92,36 @@ public function testGetMetadataFor_ReturnsLoadedCustomIdGenerator(): void $this->assertInstanceOf(CustomIdGenerator::class, $actual->idGenerator); } - public function testGetMetadataFor_ThrowsExceptionOnUnknownCustomGeneratorClass(): void + public function testGetMetadataForThrowsExceptionOnUnknownCustomGeneratorClass(): void { - $cm1 = $this->_createValidClassMetadata(); + $cm1 = $this->createValidClassMetadata(); $cm1->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM); $cm1->customGeneratorDefinition = ['class' => 'NotExistingGenerator']; - $cmf = $this->_createTestFactory(); + $cmf = $this->createTestFactory(); $cmf->setMetadataForClass($cm1->name, $cm1); $this->expectException(ORMException::class); $actual = $cmf->getMetadataFor($cm1->name); } - public function testGetMetadataFor_ThrowsExceptionOnMissingCustomGeneratorDefinition(): void + public function testGetMetadataForThrowsExceptionOnMissingCustomGeneratorDefinition(): void { - $cm1 = $this->_createValidClassMetadata(); + $cm1 = $this->createValidClassMetadata(); $cm1->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_CUSTOM); - $cmf = $this->_createTestFactory(); + $cmf = $this->createTestFactory(); $cmf->setMetadataForClass($cm1->name, $cm1); $this->expectException(ORMException::class); $actual = $cmf->getMetadataFor($cm1->name); } - public function testHasGetMetadata_NamespaceSeparatorIsNotNormalized(): void + public function testHasGetMetadataNamespaceSeparatorIsNotNormalized(): void { require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; $metadataDriver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Global/']); - $entityManager = $this->_createEntityManager($metadataDriver); + $entityManager = $this->createEntityManager($metadataDriver); $mf = $entityManager->getMetadataFactory(); $m1 = $mf->getMetadataFor(DoctrineGlobal_Article::class); @@ -150,7 +150,7 @@ public function testIsTransient(): void ->with($this->equalTo(CmsArticle::class)) ->will($this->returnValue(false)); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $this->assertTrue($em->getMetadataFactory()->isTransient(CmsUser::class)); $this->assertFalse($em->getMetadataFactory()->isTransient(CmsArticle::class)); @@ -172,7 +172,7 @@ public function testIsTransientEntityNamespace(): void ->with($this->equalTo(CmsArticle::class)) ->will($this->returnValue(false)); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $em->getConfiguration()->addEntityNamespace('CMS', 'Doctrine\Tests\Models\CMS'); $this->assertTrue($em->getMetadataFactory()->isTransient('CMS:CmsUser')); @@ -185,7 +185,7 @@ public function testAddDefaultDiscriminatorMap(): void $cmf = new ClassMetadataFactory(); $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/JoinedInheritanceType/']); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $cmf->setEntityManager($em); $rootMetadata = $cmf->getMetadataFor(RootClass::class); @@ -225,7 +225,7 @@ public function testGetAllMetadataWorksWithBadConnection(): void // DDC-3551 $conn = $this->createMock(Connection::class); $mockDriver = new MetadataDriverMock(); - $em = $this->_createEntityManager($mockDriver, $conn); + $em = $this->createEntityManager($mockDriver, $conn); $conn->expects($this->any()) ->method('getDatabasePlatform') @@ -240,7 +240,7 @@ public function testGetAllMetadataWorksWithBadConnection(): void $this->assertEquals([], $metadata); } - protected function _createEntityManager($metadataDriver, $conn = null) + protected function createEntityManager(MappingDriver $metadataDriver, $conn = null): EntityManagerMock { $driverMock = new DriverMock(); $config = new Configuration(); @@ -256,20 +256,17 @@ protected function _createEntityManager($metadataDriver, $conn = null) return EntityManagerMock::create($conn, $config, $eventManager); } - protected function _createTestFactory(): ClassMetadataFactoryTestSubject + protected function createTestFactory(): ClassMetadataFactoryTestSubject { $mockDriver = new MetadataDriverMock(); - $entityManager = $this->_createEntityManager($mockDriver); + $entityManager = $this->createEntityManager($mockDriver); $cmf = new ClassMetadataFactoryTestSubject(); $cmf->setEntityManager($entityManager); return $cmf; } - /** - * @param string $class - */ - protected function _createValidClassMetadata(): ClassMetadata + protected function createValidClassMetadata(): ClassMetadata { // Self-made metadata $cm1 = new ClassMetadata(TestEntity1::class); @@ -301,7 +298,7 @@ public function testQuoteMetadata(): void { $cmf = new ClassMetadataFactory(); $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Quote/']); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $cmf->setEntityManager($em); $userMetadata = $cmf->getMetadataFor(Quote\User::class); @@ -378,7 +375,7 @@ public function testFallbackLoadingCausesEventTriggeringThatCanModifyFetchedMeta assert($metadata instanceof ClassMetadata); $cmf = new ClassMetadataFactory(); $mockDriver = new MetadataDriverMock(); - $em = $this->_createEntityManager($mockDriver); + $em = $this->createEntityManager($mockDriver); $listener = $this->getMockBuilder(stdClass::class)->setMethods(['onClassMetadataNotFound'])->getMock(); $eventManager = $em->getEventManager(); @@ -422,7 +419,7 @@ public function testAcceptsEntityManagerInterfaceInstances(): void */ public function testRejectsEmbeddableWithoutValidClassName(): void { - $metadata = $this->_createValidClassMetadata(); + $metadata = $this->createValidClassMetadata(); $metadata->mapEmbedded( [ @@ -432,7 +429,7 @@ public function testRejectsEmbeddableWithoutValidClassName(): void ] ); - $cmf = $this->_createTestFactory(); + $cmf = $this->createTestFactory(); $cmf->setMetadataForClass($metadata->name, $metadata); @@ -449,7 +446,7 @@ public function testInheritsIdGeneratorMappingFromEmbeddable(): void { $cmf = new ClassMetadataFactory(); $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/DDC4006/']); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $cmf->setEntityManager($em); $userMetadata = $cmf->getMetadataFor(DDC4006User::class); @@ -464,7 +461,7 @@ public function testInvalidSubClassCase(): void $cmf = new ClassMetadataFactory(); $driver = $this->createAnnotationDriver([__DIR__]); - $em = $this->_createEntityManager($driver); + $em = $this->createEntityManager($driver); $cmf->setEntityManager($em); $userMetadata = $cmf->getMetadataFor(Shape::class); @@ -479,7 +476,12 @@ public function testInvalidSubClassCase(): void */ abstract class Shape { - /** @Id @Column(type="string") @GeneratedValue(strategy="AUTO") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="AUTO") + */ public $id; } @@ -491,11 +493,17 @@ final class Cube extends Shape /* Test subject class with overridden factory method for mocking purposes */ class ClassMetadataFactoryTestSubject extends ClassMetadataFactory { - private $mockMetadata = []; + /** @psalm-var array, ClassMetadata> */ + private $mockMetadata = []; + + /** @psalm-var list> */ private $requestedClasses = []; - /** @override */ - protected function newClassMetadataInstance($className) + /** + * @psalm-param class-string $className + * @override + */ + protected function newClassMetadataInstance($className): ClassMetadata { $this->requestedClasses[] = $className; if (! isset($this->mockMetadata[$className])) { @@ -508,12 +516,18 @@ protected function newClassMetadataInstance($className) return $this->mockMetadata[$className]; } - public function setMetadataForClass($className, $metadata): void + /** + * @psalm-param class-string $className + */ + public function setMetadataForClass(string $className, ClassMetadata $metadata): void { $this->mockMetadata[$className] = $metadata; } - public function getRequestedClasses() + /** + * @return list> + */ + public function getRequestedClasses(): array { return $this->requestedClasses; } @@ -521,10 +535,19 @@ public function getRequestedClasses() class TestEntity1 { + /** @var int */ private $id; + + /** @var string */ private $name; + + /** @var mixed */ private $other; + + /** @var mixed */ private $association; + + /** @var mixed */ private $embedded; } diff --git a/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php b/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php index 822ea48d181..fee160f1a74 100644 --- a/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php @@ -127,7 +127,7 @@ public function buildClassMetadata(string $className) /** * @return EntityManagerInterface|PHPUnit_Framework_MockObject_MockObject */ - private function createEntityManager() + private function createEntityManager(): EntityManagerInterface { $entityManager = $this->createMock(EntityManagerInterface::class); diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php index 7ba8502e167..d7d11308afe 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php @@ -147,41 +147,59 @@ public function testFilterWithRegex(): void /** @Entity */ class MetadataFilterTestEntityAaa { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } /** @Entity */ class MetadataFilterTestEntityBbb { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } /** @Entity */ class MetadataFilterTestEntityCcc { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } /** @Entity */ class MetadataFilterTestEntityFoo { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } /** @Entity */ class MetadataFilterTestEntityBar { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } /** @Entity */ class MetadataFilterTestEntityFooBar { - /** @Id @Column */ + /** + * @Id + * @Column + */ protected $id; } diff --git a/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php b/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php index c0c4fa568b9..20dbf12f9d8 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ConvertDoctrine1SchemaTest.php @@ -10,6 +10,7 @@ use Doctrine\ORM\Tools\ConvertDoctrine1Schema; use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; use Doctrine\ORM\Tools\Export\ClassMetadataExporter; +use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\DriverMock; use Doctrine\Tests\Mocks\EntityManagerMock; @@ -31,7 +32,7 @@ class ConvertDoctrine1SchemaTest extends OrmTestCase { use VerifyDeprecations; - protected function _createEntityManager($metadataDriver) + protected function createEntityManager(MappingDriver $metadataDriver): EntityManagerMock { $driverMock = new DriverMock(); $config = new Configuration(); @@ -62,7 +63,7 @@ public function testTest(): void $this->assertTrue(file_exists(__DIR__ . '/convert/Profile.dcm.yml')); $metadataDriver = new YamlDriver(__DIR__ . '/convert'); - $em = $this->_createEntityManager($metadataDriver); + $em = $this->createEntityManager($metadataDriver); $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); $metadata = $cmf->getAllMetadata(); diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index cfb57aec23b..ee8bcb3485a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -6,6 +6,7 @@ use Doctrine\Common\EventManager; use Doctrine\ORM\Configuration; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataFactory; @@ -16,6 +17,7 @@ use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; use Doctrine\ORM\Tools\EntityGenerator; use Doctrine\ORM\Tools\Export\ClassMetadataExporter; +use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Persistence\Mapping\Driver\PHPDriver; use Doctrine\Tests\Mocks\ConnectionMock; use Doctrine\Tests\Mocks\DriverMock; @@ -47,11 +49,12 @@ abstract class AbstractClassMetadataExporterTest extends OrmTestCase { use VerifyDeprecations; + /** @var string|null */ protected $_extension; abstract protected function _getType(): string; - protected function _createEntityManager($metadataDriver) + protected function createEntityManager($metadataDriver): EntityManagerMock { $driverMock = new DriverMock(); $config = new Configuration(); @@ -64,7 +67,7 @@ protected function _createEntityManager($metadataDriver) return EntityManagerMock::create($conn, $config, $eventManager); } - protected function _createMetadataDriver($type, $path) + protected function createMetadataDriver(string $type, string $path): MappingDriver { $mappingDriver = [ 'php' => PHPDriver::class, @@ -82,7 +85,7 @@ protected function _createMetadataDriver($type, $path) : new $class($path); } - protected function _createClassMetadataFactory($em, $type) + protected function createClassMetadataFactory(EntityManagerInterface $em, string $type): ClassMetadataFactory { $factory = $type === 'annotation' ? new ClassMetadataFactory() @@ -95,12 +98,12 @@ protected function _createClassMetadataFactory($em, $type) public function testExportDirectoryAndFilesAreCreated(): void { - $this->_deleteDirectory(__DIR__ . '/export/' . $this->_getType()); + $this->deleteDirectory(__DIR__ . '/export/' . $this->_getType()); $type = $this->_getType(); - $metadataDriver = $this->_createMetadataDriver($type, __DIR__ . '/' . $type); - $em = $this->_createEntityManager($metadataDriver); - $cmf = $this->_createClassMetadataFactory($em, $type); + $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/' . $type); + $em = $this->createEntityManager($metadataDriver); + $cmf = $this->createClassMetadataFactory($em, $type); $metadata = $cmf->getAllMetadata(); $metadata[0]->name = ExportedUser::class; @@ -135,13 +138,13 @@ public function testExportDirectoryAndFilesAreCreated(): void /** * @depends testExportDirectoryAndFilesAreCreated */ - public function testExportedMetadataCanBeReadBackIn() + public function testExportedMetadataCanBeReadBackIn(): ClassMetadataInfo { $type = $this->_getType(); - $metadataDriver = $this->_createMetadataDriver($type, __DIR__ . '/export/' . $type); - $em = $this->_createEntityManager($metadataDriver); - $cmf = $this->_createClassMetadataFactory($em, $type); + $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/export/' . $type); + $em = $this->createEntityManager($metadataDriver); + $cmf = $this->createClassMetadataFactory($em, $type); $metadata = $cmf->getAllMetadata(); $this->assertEquals(1, count($metadata)); @@ -156,7 +159,7 @@ public function testExportedMetadataCanBeReadBackIn() /** * @depends testExportedMetadataCanBeReadBackIn */ - public function testTableIsExported(ClassMetadataInfo $class) + public function testTableIsExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertEquals('cms_users', $class->table['name']); $this->assertEquals( @@ -170,7 +173,7 @@ public function testTableIsExported(ClassMetadataInfo $class) /** * @depends testTableIsExported */ - public function testTypeIsExported(ClassMetadataInfo $class) + public function testTypeIsExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertFalse($class->isMappedSuperclass); @@ -180,7 +183,7 @@ public function testTypeIsExported(ClassMetadataInfo $class) /** * @depends testTypeIsExported */ - public function testIdentifierIsExported(ClassMetadataInfo $class) + public function testIdentifierIsExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_IDENTITY, $class->generatorType, 'Generator Type wrong'); $this->assertEquals(['id'], $class->identifier); @@ -192,7 +195,7 @@ public function testIdentifierIsExported(ClassMetadataInfo $class) /** * @depends testIdentifierIsExported */ - public function testFieldsAreExported(ClassMetadataInfo $class) + public function testFieldsAreExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue(isset($class->fieldMappings['id']['id']) && $class->fieldMappings['id']['id'] === true); $this->assertEquals('id', $class->fieldMappings['id']['fieldName']); @@ -238,7 +241,7 @@ public function testFieldsAreProperlySerialized(): void /** * @depends testFieldsAreExported */ - public function testOneToOneAssociationsAreExported(ClassMetadataInfo $class) + public function testOneToOneAssociationsAreExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue(isset($class->associationMappings['address'])); $this->assertEquals(Address::class, $class->associationMappings['address']['targetEntity']); @@ -269,7 +272,7 @@ public function testManyToOneAssociationsAreExported($class): void /** * @depends testOneToOneAssociationsAreExported */ - public function testOneToManyAssociationsAreExported(ClassMetadataInfo $class) + public function testOneToManyAssociationsAreExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue(isset($class->associationMappings['phonenumbers'])); $this->assertEquals(Phonenumber::class, $class->associationMappings['phonenumbers']['targetEntity']); @@ -288,11 +291,9 @@ public function testOneToManyAssociationsAreExported(ClassMetadataInfo $class) } /** - * @param ClassMetadataInfo $metadata - * * @depends testOneToManyAssociationsAreExported */ - public function testManyToManyAssociationsAreExported($class) + public function testManyToManyAssociationsAreExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue(isset($class->associationMappings['groups'])); $this->assertEquals(Group::class, $class->associationMappings['groups']['targetEntity']); @@ -318,7 +319,7 @@ public function testManyToManyAssociationsAreExported($class) /** * @depends testManyToManyAssociationsAreExported */ - public function testLifecycleCallbacksAreExported(ClassMetadataInfo $class) + public function testLifecycleCallbacksAreExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue(isset($class->lifecycleCallbacks['prePersist'])); $this->assertEquals(2, count($class->lifecycleCallbacks['prePersist'])); @@ -335,7 +336,7 @@ public function testLifecycleCallbacksAreExported(ClassMetadataInfo $class) /** * @depends testLifecycleCallbacksAreExported */ - public function testCascadeIsExported(ClassMetadataInfo $class) + public function testCascadeIsExported(ClassMetadataInfo $class): ClassMetadataInfo { $this->assertTrue($class->associationMappings['phonenumbers']['isCascadePersist']); $this->assertTrue($class->associationMappings['phonenumbers']['isCascadeMerge']); @@ -400,25 +401,20 @@ public function testEntityListenersAreExported(ClassMetadata $class): void $this->assertEquals('customPostPersist', $class->entityListeners[Events::postPersist][1]['method']); } - public function __destruct() - { -// $this->_deleteDirectory(__DIR__ . '/export/'.$this->_getType()); - } - - protected function _deleteDirectory($path) + protected function deleteDirectory(string $path): void { if (is_file($path)) { - return unlink($path); + unlink($path); } elseif (is_dir($path)) { $files = glob(rtrim($path, '/') . '/*'); if (is_array($files)) { foreach ($files as $file) { - $this->_deleteDirectory($file); + $this->deleteDirectory($file); } } - return rmdir($path); + rmdir($path); } } } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php index 5499a4540ea..e6a8d9a218c 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountOutputWalkerTest.php @@ -23,7 +23,7 @@ public function testCountQuery(): void ); } - public function testCountQuery_MixedResultsWithName(): void + public function testCountQueryMixedResultsWithName(): void { $query = $this->entityManager->createQuery( 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a' diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php index 2020d285e29..18077c2436a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Tools\Pagination; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Tests\OrmTestCase; @@ -24,13 +25,30 @@ protected function setUp(): void */ class MyBlogPost { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @ManyToOne(targetEntity="Author") */ + + /** + * @var Author + * @ManyToOne(targetEntity="Author") + */ public $author; - /** @ManyToOne(targetEntity="Category") */ + + /** + * @var Category + * @ManyToOne(targetEntity="Category") + */ public $category; - /** @Column(type="string") */ + + /** + * @var string + * @Column(type="string") + */ public $title; } @@ -39,7 +57,12 @@ class MyBlogPost */ class MyAuthor { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -48,7 +71,12 @@ class MyAuthor */ class MyCategory { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -58,11 +86,24 @@ class MyCategory */ class BlogPost { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @ManyToOne(targetEntity="Author") */ + + /** + * @var Author + * @ManyToOne(targetEntity="Author") + */ public $author; - /** @ManyToOne(targetEntity="Category") */ + + /** + * @var Category + * @ManyToOne(targetEntity="Category") + */ public $category; } @@ -71,9 +112,18 @@ class BlogPost */ class Author { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @Column(type="string") */ + + /** + * @var string + * @Column(type="string") + */ public $name; } @@ -82,11 +132,24 @@ class Author */ class Person { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @Column(type="string") */ + + /** + * @var string + * @Column(type="string") + */ public $name; - /** @Column(type="string") */ + + /** + * @var string + * @Column(type="string") + */ public $biography; } @@ -95,7 +158,12 @@ class Person */ class Category { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -103,18 +171,34 @@ class Category /** @Entity @Table(name="groups") */ class Group { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @ManyToMany(targetEntity="User", mappedBy="groups") */ + + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="User", mappedBy="groups") + */ public $users; } /** @Entity */ class User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; + /** + * @psalm-var Collection * @ManyToMany(targetEntity="Group", inversedBy="users") * @JoinTable( * name="user_group", @@ -123,37 +207,69 @@ class User * ) */ public $groups; - /** @OneToOne(targetEntity="Avatar", mappedBy="user") */ + + /** + * @var Avatar + * @OneToOne(targetEntity="Avatar", mappedBy="user") + */ public $avatar; } /** @Entity */ class Avatar { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; + /** + * @var User * @OneToOne(targetEntity="User", inversedBy="avatar") * @JoinColumn(name="user_id", referencedColumnName="id") */ public $user; - /** @Column(type="string", length=255) */ + + /** + * @var string + * @Column(type="string", length=255) + */ public $image; - /** @Column(type="integer") */ + + /** + * @var int + * @Column(type="integer") + */ public $image_height; - /** @Column(type="integer") */ + + /** + * @var int + * @Column(type="integer") + */ public $image_width; - /** @Column(type="string", length=255) */ + + /** + * @var string + * @Column(type="string", length=255) + */ public $image_alt_desc; } /** @MappedSuperclass */ abstract class Identified { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; - public function getId() + public function getId(): int { return $this->id; } @@ -162,6 +278,9 @@ public function getId() /** @Entity */ class Banner extends Identified { - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $name; } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php index d97bb21c0f1..c9a8cbaf32b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/WhereInWalkerTest.php @@ -25,7 +25,7 @@ protected function setUp(): void } } - public function testWhereInQuery_NoWhere(): void + public function testWhereInQueryNoWhere(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g' @@ -46,7 +46,7 @@ public function testWhereInQuery_NoWhere(): void ); } - public function testCountQuery_MixedResultsWithName(): void + public function testCountQueryMixedResultsWithName(): void { $query = $this->entityManager->createQuery( 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a' @@ -67,7 +67,7 @@ public function testCountQuery_MixedResultsWithName(): void ); } - public function testWhereInQuery_SingleWhere(): void + public function testWhereInQuerySingleWhere(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE 1 = 1' @@ -88,7 +88,7 @@ public function testWhereInQuery_SingleWhere(): void ); } - public function testWhereInQuery_MultipleWhereWithAnd(): void + public function testWhereInQueryMultipleWhereWithAnd(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE 1 = 1 AND 2 = 2' @@ -109,7 +109,7 @@ public function testWhereInQuery_MultipleWhereWithAnd(): void ); } - public function testWhereInQuery_MultipleWhereWithOr(): void + public function testWhereInQueryMultipleWhereWithOr(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE 1 = 1 OR 2 = 2' @@ -130,7 +130,7 @@ public function testWhereInQuery_MultipleWhereWithOr(): void ); } - public function testWhereInQuery_MultipleWhereWithMixed_1(): void + public function testWhereInQueryMultipleWhereWithMixed1(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE (1 = 1 OR 2 = 2) AND 3 = 3' @@ -151,7 +151,7 @@ public function testWhereInQuery_MultipleWhereWithMixed_1(): void ); } - public function testWhereInQuery_MultipleWhereWithMixed_2(): void + public function testWhereInQueryMultipleWhereWithMixed2(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE 1 = 1 AND 2 = 2 OR 3 = 3' @@ -172,7 +172,7 @@ public function testWhereInQuery_MultipleWhereWithMixed_2(): void ); } - public function testWhereInQuery_WhereNot(): void + public function testWhereInQueryWhereNot(): void { $query = $this->entityManager->createQuery( 'SELECT u, g FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.groups g WHERE NOT 1 = 2' @@ -196,7 +196,7 @@ public function testWhereInQuery_WhereNot(): void /** * Arbitrary Join */ - public function testWhereInQueryWithArbitraryJoin_NoWhere(): void + public function testWhereInQueryWithArbitraryJoinNoWhere(): void { $whereInQuery = $this->entityManager->createQuery( 'SELECT p FROM Doctrine\Tests\ORM\Tools\Pagination\BlogPost p JOIN Doctrine\Tests\ORM\Tools\Pagination\Category c WITH p.category = c' @@ -216,7 +216,7 @@ public function testWhereInQueryWithArbitraryJoin_NoWhere(): void ); } - public function testWhereInQueryWithArbitraryJoin_SingleWhere(): void + public function testWhereInQueryWithArbitraryJoinSingleWhere(): void { $whereInQuery = $this->entityManager->createQuery( 'SELECT p FROM Doctrine\Tests\ORM\Tools\Pagination\BlogPost p JOIN Doctrine\Tests\ORM\Tools\Pagination\Category c WITH p.category = c WHERE 1 = 1' diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index 2edd9b3f40a..69eb54dd722 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Tools; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; use Doctrine\ORM\Tools\Event\GenerateSchemaTableEventArgs; @@ -284,16 +285,26 @@ public function testDerivedCompositeKey(): void */ class TestEntityWithAnnotationOptionsAttribute { - /** @Id @Column */ + /** + * @var int + * @Id + * @Column + */ private $id; - /** @Column(type="string", options={"foo": "bar", "baz": {"key": "val"}}) */ + /** + * @var string + * @Column(type="string", options={"foo": "bar", "baz": {"key": "val"}}) + */ private $test; } class GenerateSchemaEventListener { - public $tableCalls = 0; + /** @var int */ + public $tableCalls = 0; + + /** @var bool */ public $schemaCalled = false; public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs): void @@ -315,10 +326,17 @@ public function postGenerateSchema(GenerateSchemaEventArgs $eventArgs): void */ class UniqueConstraintAnnotationModel { - /** @Id @Column */ + /** + * @var int + * @Id + * @Column + */ private $id; - /** @Column(name="hash", type="string", length=8, nullable=false, unique=true) */ + /** + * @var string + * @Column(name="hash", type="string", length=8, nullable=false, unique=true) + */ private $hash; } @@ -329,18 +347,23 @@ class UniqueConstraintAnnotationModel class FirstEntity { /** + * @var int * @Id * @Column(name="id") */ public $id; /** + * @var SecondEntity * @OneToOne(targetEntity="SecondEntity") * @JoinColumn(name="id", referencedColumnName="fist_entity_id") */ public $secondEntity; - /** @Column(name="name") */ + /** + * @var string + * @Column(name="name") + */ public $name; } @@ -351,12 +374,16 @@ class FirstEntity class SecondEntity { /** + * @var int * @Id * @Column(name="fist_entity_id") */ public $fist_entity_id; - /** @Column(name="name") */ + /** + * @var string + * @Column(name="name") + */ public $name; } @@ -366,12 +393,14 @@ class SecondEntity class GH6830Board { /** + * @var int * @Id * @Column(type="integer") */ public $id; /** + * @var GH6830Category * @ManyToOne(targetEntity=GH6830Category::class, inversedBy="boards") * @JoinColumn(name="category_id", referencedColumnName="id") */ @@ -390,6 +419,9 @@ class GH6830Category */ public $id; - /** @OneToMany(targetEntity=GH6830Board::class, mappedBy="category") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity=GH6830Board::class, mappedBy="category") + */ public $boards; } diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php index 23292c2071a..63eb7d1d422 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php @@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\OneToOne; use Doctrine\ORM\Tools\SchemaValidator; +use Doctrine\Tests\Models\ECommerce\ECommerceCart; use Doctrine\Tests\OrmTestCase; class SchemaValidatorTest extends OrmTestCase @@ -456,19 +457,36 @@ class DDC3322ValidEntity1 */ class DDC3322ValidEntity2 { - /** @Id @Column @GeneratedValue */ + /** + * @var int + * @Id + * @Column + * @GeneratedValue + */ private $id; - /** @ManyToOne(targetEntity="DDC3322ValidEntity1", inversedBy="oneToMany") */ + /** + * @var DDC3322ValidEntity1 + * @ManyToOne(targetEntity="DDC3322ValidEntity1", inversedBy="oneToMany") + */ private $manyToOne; - /** @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="manyToOne") */ + /** + * @var DDC3322ValidEntity1 + * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="manyToOne") + */ private $oneToMany; - /** @OneToOne(targetEntity="DDC3322ValidEntity1", inversedBy="oneToOneInverse") */ + /** + * @var DDC3322ValidEntity1 + * @OneToOne(targetEntity="DDC3322ValidEntity1", inversedBy="oneToOneInverse") + */ private $oneToOneOwning; - /** @OneToOne(targetEntity="DDC3322ValidEntity1", mappedBy="oneToOneOwning") */ + /** + * @var DDC3322ValidEntity1 + * @OneToOne(targetEntity="DDC3322ValidEntity1", mappedBy="oneToOneOwning") + */ private $oneToOneInverse; } @@ -477,16 +495,23 @@ class DDC3322ValidEntity2 */ class DDC3322One { - /** @Id @Column @GeneratedValue */ + /** + * @var int + * @Id + * @Column + * @GeneratedValue + */ private $id; /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="oneValid") * @OrderBy({"id" = "ASC"}) */ private $validAssoc; /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="oneInvalid") * @OrderBy({"invalidField" = "ASC"}) */ @@ -498,16 +523,23 @@ class DDC3322One */ class DDC3322Two { - /** @Id @Column @GeneratedValue */ + /** + * @var int + * @Id + * @Column + * @GeneratedValue + */ private $id; /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="twoValid") * @OrderBy({"manyToOne" = "ASC"}) */ private $validAssoc; /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="twoInvalid") * @OrderBy({"oneToMany" = "ASC"}) */ @@ -519,16 +551,23 @@ class DDC3322Two */ class DDC3322Three { - /** @Id @Column @GeneratedValue */ + /** + * @var int + * @Id + * @Column + * @GeneratedValue + */ private $id; /** + * @var DDC3322ValidEntity1 * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="threeValid") * @OrderBy({"oneToOneOwning" = "ASC"}) */ private $validAssoc; /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC3322ValidEntity1", mappedBy="threeInvalid") * @OrderBy({"oneToOneInverse" = "ASC"}) */ @@ -540,6 +579,9 @@ class DDC3322Three */ class EmbeddableWithAssociation { - /** @OneToOne(targetEntity="Doctrine\Tests\Models\ECommerce\ECommerceCart") */ + /** + * @var ECommerceCart + * @OneToOne(targetEntity="Doctrine\Tests\Models\ECommerce\ECommerceCart") + */ private $cart; } diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index b9caa793871..8dc38590b05 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -829,7 +829,10 @@ class NotifyChangedEntity implements NotifyPropertyChanged * @GeneratedValue */ private $id; - /** @Column(type="string") */ + /** + * @var string + * @Column(type="string") + */ private $data; private $transient; // not persisted From 0f655f9fb677e86b2a875f20b65a5ce89448f3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 7 Feb 2021 10:57:26 +0100 Subject: [PATCH 05/27] Manually fix cs --- .../Doctrine/Tests/Models/CMS/CmsArticle.php | 6 +- .../ORM/Cache/DefaultCacheFactoryTest.php | 2 +- .../Tests/ORM/Cache/DefaultCacheTest.php | 2 +- .../ORM/Cache/DefaultEntityHydratorTest.php | 2 +- .../Tests/ORM/Cache/DefaultQueryCacheTest.php | 2 +- .../AbstractCollectionPersisterTest.php | 2 +- .../Entity/AbstractEntityPersisterTest.php | 2 +- .../Doctrine/Tests/ORM/EntityManagerTest.php | 2 +- .../ORM/Functional/Ticket/DDC3634Test.php | 76 +++++++++++- .../ORM/Functional/Ticket/DDC3711Test.php | 4 +- .../ORM/Functional/Ticket/GH5804Test.php | 5 +- .../ORM/Functional/Ticket/GH8061Test.php | 2 +- .../ORM/Hydration/CustomHydratorTest.php | 2 +- .../Tests/ORM/Hydration/HydrationTestCase.php | 2 +- .../ORM/Hydration/ResultSetMappingTest.php | 2 +- .../Tests/ORM/Id/AssignedGeneratorTest.php | 2 +- .../Tests/ORM/Id/SequenceGeneratorTest.php | 2 +- .../ORM/Mapping/AbstractMappingDriverTest.php | 108 +++++++++++------- .../ORM/Mapping/AnnotationDriverTest.php | 87 +++++++++----- .../ORM/Mapping/AnsiQuoteStrategyTest.php | 2 +- .../Mapping/BasicInheritanceMappingTest.php | 2 +- .../Mapping/ClassMetadataLoadEventTest.php | 2 +- .../ORM/Mapping/DefaultQuoteStrategyTest.php | 2 +- .../ORM/Mapping/PHPMappingDriverTest.php | 4 +- .../Tests/ORM/Mapping/QuoteStrategyTest.php | 4 +- .../Mapping/StaticPHPMappingDriverTest.php | 2 +- .../ORM/Mapping/XmlMappingDriverTest.php | 22 ++-- .../ORM/Mapping/YamlMappingDriverTest.php | 6 +- ...tyPersisterCompositeTypeParametersTest.php | 2 +- ...sicEntityPersisterCompositeTypeSqlTest.php | 2 +- .../BasicEntityPersisterTypeValueSqlTest.php | 2 +- .../JoinedSubclassPersisterTest.php | 2 +- .../Persisters/ManyToManyPersisterTest.php | 2 +- .../ORM/Query/CustomTreeWalkersJoinTest.php | 2 +- .../Tests/ORM/Query/CustomTreeWalkersTest.php | 2 +- .../ORM/Query/DeleteSqlGenerationTest.php | 2 +- tests/Doctrine/Tests/ORM/Query/ExprTest.php | 2 +- .../Tests/ORM/Query/FilterCollectionTest.php | 2 +- .../ORM/Query/LanguageRecognitionTest.php | 2 +- tests/Doctrine/Tests/ORM/Query/ParserTest.php | 4 +- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 2 +- .../ORM/Query/SelectSqlGenerationTest.php | 53 ++++++--- .../Tests/ORM/Query/SqlWalkerTest.php | 2 +- .../ORM/Query/UpdateSqlGenerationTest.php | 2 +- tests/Doctrine/Tests/ORM/QueryBuilderTest.php | 2 +- .../AttachEntityListenersListenerTest.php | 2 +- .../ORM/Tools/Console/MetadataFilterTest.php | 2 +- .../Tests/ORM/Tools/EntityGeneratorTest.php | 6 +- .../Tools/EntityRepositoryGeneratorTest.php | 6 +- .../Tools/Pagination/PaginationTestCase.php | 2 +- .../ORM/Tools/Pagination/PaginatorTest.php | 2 +- .../Tools/ResolveTargetEntityListenerTest.php | 2 +- .../Tests/ORM/Tools/SchemaToolTest.php | 20 ++-- .../Tests/ORM/Tools/SchemaValidatorTest.php | 2 +- tests/Doctrine/Tests/OrmTestCase.php | 8 +- 55 files changed, 326 insertions(+), 171 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php index 001bd439662..8d187bf5b87 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php @@ -18,7 +18,11 @@ class CmsArticle public $id; /** @Column(type="string", length=255) */ public $topic; - /** @Column(type="text") */ + + /** + * @var string + * @Column(type="text") + */ public $text; /** * @ManyToOne(targetEntity="CmsUser", inversedBy="articles") diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php index 4c2e560d55f..8dfd025206c 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php @@ -53,7 +53,7 @@ protected function setUp(): void $this->enableSecondLevelCache(); parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->regionsConfig = new RegionsConfiguration(); $arguments = [$this->regionsConfig, $this->getSharedSecondLevelCacheDriverImpl()]; $this->factory = $this->getMockBuilder(DefaultCacheFactory::class) diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php index bc97977241f..78c27868c0e 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php @@ -36,7 +36,7 @@ protected function setUp(): void parent::enableSecondLevelCache(); parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->cache = new DefaultCache($this->em); } diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultEntityHydratorTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultEntityHydratorTest.php index 8e1835066c0..144bec3db15 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultEntityHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultEntityHydratorTest.php @@ -31,7 +31,7 @@ protected function setUp(): void { parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->structure = new DefaultEntityHydrator($this->em); } diff --git a/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php b/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php index d856dbf4e5a..56af32e4cab 100644 --- a/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php @@ -51,7 +51,7 @@ protected function setUp(): void $this->enableSecondLevelCache(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->region = new CacheRegionMock(); $this->queryCache = new DefaultQueryCache($this->em, $this->region); $this->cacheFactory = new CacheFactoryDefaultQueryCacheTest($this->queryCache, $this->region); diff --git a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php index 7acad44fcb2..d085da5e75a 100644 --- a/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/Persister/Collection/AbstractCollectionPersisterTest.php @@ -66,7 +66,7 @@ protected function setUp(): void $this->enableSecondLevelCache(); parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->region = $this->createRegion(); $this->collectionPersister = $this->getMockBuilder(CollectionPersister::class) ->setMethods($this->collectionPersisterMockMethods) diff --git a/tests/Doctrine/Tests/ORM/Cache/Persister/Entity/AbstractEntityPersisterTest.php b/tests/Doctrine/Tests/ORM/Cache/Persister/Entity/AbstractEntityPersisterTest.php index 16793812357..f6069ab9f4d 100644 --- a/tests/Doctrine/Tests/ORM/Cache/Persister/Entity/AbstractEntityPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Cache/Persister/Entity/AbstractEntityPersisterTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->enableSecondLevelCache(); parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->region = $this->createRegion(); $this->entityPersister = $this->createMock(EntityPersister::class); } diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index 68fcff8e3f4..d68136e417d 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -42,7 +42,7 @@ class EntityManagerTest extends OrmTestCase protected function setUp(): void { parent::setUp(); - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3634Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3634Test.php index 46eb0df75d6..1bd2e6389d4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3634Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3634Test.php @@ -83,7 +83,12 @@ public function testSavesIntegerAutoGeneratedValueAsStringWithJoinedInheritance( /** @Entity */ class DDC3634Entity { - /** @Id @Column(type="bigint") @GeneratedValue(strategy="AUTO") */ + /** + * @var int + * @Id + * @Column(type="bigint") + * @GeneratedValue(strategy="AUTO") + */ public $id; } @@ -97,7 +102,12 @@ class DDC3634Entity */ class DDC3634JTIBaseEntity { - /** @Id @Column(type="bigint") @GeneratedValue(strategy="AUTO") */ + /** + * @var int + * @Id + * @Column(type="bigint") + * @GeneratedValue(strategy="AUTO") + */ public $id; } @@ -123,6 +133,9 @@ public function __construct($identifier, Connection $realConnection) $this->identifier = $identifier; } + /** + * @return mixed + */ private function forwardCall() { $trace = debug_backtrace(0, 2)[1]; @@ -130,296 +143,355 @@ private function forwardCall() return call_user_func_array([$this->realConnection, $trace['function']], $trace['args']); } + /** {@inheritDoc} */ public function getParams() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getDatabase() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getHost() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getPort() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getUsername() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getPassword() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getDriver() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getConfiguration() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getEventManager() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getDatabasePlatform() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getExpressionBuilder() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function connect() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function isAutoCommit() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function setAutoCommit($autoCommit) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function setFetchMode($fetchMode) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function fetchAssoc($statement, array $params = [], array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function fetchArray($statement, array $params = [], array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function fetchColumn($statement, array $params = [], $column = 0, array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function isConnected() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function isTransactionActive() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function delete($tableExpression, array $identifier, array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function close() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function setTransactionIsolation($level) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getTransactionIsolation() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function update($tableExpression, array $data, array $identifier, array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function insert($tableExpression, array $data, array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function quoteIdentifier($str) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function quote($input, $type = null) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function fetchAll($sql, array $params = [], $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function prepare($statement) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function executeQuery($query, array $params = [], $types = [], ?QueryCacheProfile $qcp = null) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qcp) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function project($query, array $params, Closure $function) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function query() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function executeUpdate($query, array $params = [], array $types = []) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function exec($statement) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getTransactionNestingLevel() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function errorCode() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function errorInfo() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function lastInsertId($seqName = null) { return $this->identifier; } + /** {@inheritDoc} */ public function transactional(Closure $func) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getNestTransactionsWithSavepoints() { return $this->forwardCall(); } + /** {@inheritDoc} */ protected function _getNestedTransactionSavePointName() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function beginTransaction() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function commit() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function rollBack() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function createSavepoint($savepoint) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function releaseSavepoint($savepoint) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function rollbackSavepoint($savepoint) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getWrappedConnection() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function getSchemaManager() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function setRollbackOnly() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function isRollbackOnly() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function convertToDatabaseValue($value, $type) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function convertToPHPValue($value, $type) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function resolveParams(array $params, array $types) { return $this->forwardCall(); } + /** {@inheritDoc} */ public function createQueryBuilder() { return $this->forwardCall(); } + /** {@inheritDoc} */ public function ping() { return $this->forwardCall(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php index 2c9de67c9a4..e16f4dade09 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3711Test.php @@ -16,9 +16,9 @@ class DDC3711Test extends YamlMappingDriverTest public function testCompositeKeyForJoinTableInManyToManyCreation(): void { - $yamlDriver = $this->_loadDriver(); + $yamlDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($yamlDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php index 7715a97b826..68c694d2856 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php @@ -103,6 +103,9 @@ class GH5804Article */ public $version; - /** @Column(type="text") */ + /** + * @var string + * @Column(type="text") + */ public $text; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php index 1f66f435ccd..bbdd3c3b450 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php @@ -23,7 +23,7 @@ public static function setUpBeforeClass(): void public function testConvertToPHPValueSQLForNewObjectExpression(): void { $dql = 'SELECT NEW ' . GH8061Class::class . '(e.field) FROM ' . GH8061Entity::class . ' e'; - $entityManager = $this->_getTestEntityManager(); + $entityManager = $this->getTestEntityManager(); $query = $entityManager->createQuery($dql); self::assertRegExp('/SELECT DatabaseFunction\(\w+\.field\) AS /', $query->getSQL()); diff --git a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php index a318bb4d4f2..6f8329fda06 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php @@ -11,7 +11,7 @@ class CustomHydratorTest extends HydrationTestCase { public function testCustomHydrator(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $config = $em->getConfiguration(); $config->addCustomHydrationMode('CustomHydrator', CustomHydrator::class); diff --git a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php index f49046700a3..17e44527f27 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php @@ -14,7 +14,7 @@ class HydrationTestCase extends OrmTestCase protected function setUp(): void { parent::setUp(); - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } /** Helper method */ diff --git a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php index 05ac6b73f10..33302b8f6ac 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php @@ -31,7 +31,7 @@ protected function setUp(): void { parent::setUp(); $this->_rsm = new ResultSetMapping(); - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } /** diff --git a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php index 0f6cf64ab16..afa0de1017c 100644 --- a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php @@ -18,7 +18,7 @@ class AssignedGeneratorTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); $this->_assignedGen = new AssignedGenerator(); } diff --git a/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php index 06db2634f1e..b4d9fdabc1e 100644 --- a/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/SequenceGeneratorTest.php @@ -26,7 +26,7 @@ protected function setUp(): void { parent::setUp(); - $this->entityManager = $this->_getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); $this->sequenceGenerator = new SequenceGenerator('seq', 10); $this->connection = $this->entityManager->getConnection(); diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index b3dd4f4568e..9f36ad50650 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Mapping; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\ClassMetadata; @@ -51,11 +52,14 @@ abstract class AbstractMappingDriverTest extends OrmTestCase { - abstract protected function _loadDriver(): MappingDriver; + abstract protected function loadDriver(): MappingDriver; - public function createClassMetadata($entityClassName) + /** + * @psalm-param class-string $entityClassName + */ + public function createClassMetadata(string $entityClassName): ClassMetadata { - $mappingDriver = $this->_loadDriver(); + $mappingDriver = $this->loadDriver(); $class = new ClassMetadata($entityClassName); $class->initializeReflection(new RuntimeReflectionService()); @@ -69,8 +73,8 @@ public function createClassMetadata($entityClassName) */ protected function createClassMetadataFactory(?EntityManager $em = null): ClassMetadataFactory { - $driver = $this->_loadDriver(); - $em = $em ?: $this->_getTestEntityManager(); + $driver = $this->loadDriver(); + $em = $em ?: $this->getTestEntityManager(); $factory = new ClassMetadataFactory(); $em->getConfiguration()->setMetadataDriverImpl($driver); $factory->setEntityManager($em); @@ -78,7 +82,7 @@ protected function createClassMetadataFactory(?EntityManager $em = null): ClassM return $factory; } - public function testEntityTableNameAndInheritance() + public function testEntityTableNameAndInheritance(): ClassMetadata { $class = $this->createClassMetadata(User::class); @@ -91,7 +95,7 @@ public function testEntityTableNameAndInheritance() /** * @depends testEntityTableNameAndInheritance */ - public function testEntityIndexes(ClassMetadata $class) + public function testEntityIndexes(ClassMetadata $class): ClassMetadata { $this->assertArrayHasKey('indexes', $class->table, 'ClassMetadata should have indexes key in table property.'); $this->assertEquals( @@ -124,7 +128,7 @@ public function testEntityIndexFlagsAndPartialIndexes(): void /** * @depends testEntityTableNameAndInheritance */ - public function testEntityUniqueConstraints(ClassMetadata $class) + public function testEntityUniqueConstraints(ClassMetadata $class): ClassMetadata { $this->assertArrayHasKey( 'uniqueConstraints', @@ -145,7 +149,7 @@ public function testEntityUniqueConstraints(ClassMetadata $class) /** * @depends testEntityTableNameAndInheritance */ - public function testEntityOptions(ClassMetadata $class) + public function testEntityOptions(ClassMetadata $class): ClassMetadata { $this->assertArrayHasKey('options', $class->table, 'ClassMetadata should have options key in table property.'); @@ -195,7 +199,7 @@ public function testEntityCustomGenerator(): void /** * @depends testEntityTableNameAndInheritance */ - public function testFieldMappings(ClassMetadata $class) + public function testFieldMappings(ClassMetadata $class): ClassMetadata { $this->assertEquals(4, count($class->fieldMappings)); $this->assertTrue(isset($class->fieldMappings['id'])); @@ -220,7 +224,7 @@ public function testVersionedField(ClassMetadata $class): void /** * @depends testEntityTableNameAndInheritance */ - public function testFieldMappingsColumnNames(ClassMetadata $class) + public function testFieldMappingsColumnNames(ClassMetadata $class): ClassMetadata { $this->assertEquals('id', $class->fieldMappings['id']['columnName']); $this->assertEquals('name', $class->fieldMappings['name']['columnName']); @@ -232,7 +236,7 @@ public function testFieldMappingsColumnNames(ClassMetadata $class) /** * @depends testEntityTableNameAndInheritance */ - public function testStringFieldMappings(ClassMetadata $class) + public function testStringFieldMappings(ClassMetadata $class): ClassMetadata { $this->assertEquals('string', $class->fieldMappings['name']['type']); $this->assertEquals(50, $class->fieldMappings['name']['length']); @@ -256,7 +260,7 @@ public function testFieldOptions(ClassMetadata $class): ClassMetadata /** * @depends testEntityTableNameAndInheritance */ - public function testIdFieldOptions(ClassMetadata $class) + public function testIdFieldOptions(ClassMetadata $class): ClassMetadata { $this->assertEquals(['foo' => 'bar', 'unsigned' => false], $class->fieldMappings['id']['options']); @@ -266,7 +270,7 @@ public function testIdFieldOptions(ClassMetadata $class) /** * @depends testFieldMappings */ - public function testIdentifier(ClassMetadata $class) + public function testIdentifier(ClassMetadata $class): ClassMetadata { $this->assertEquals(['id'], $class->identifier); $this->assertEquals('integer', $class->fieldMappings['id']['type']); @@ -294,7 +298,7 @@ public function testBooleanValuesForOptionIsSetCorrectly(): ClassMetadata /** * @depends testIdentifier */ - public function testAssociations(ClassMetadata $class) + public function testAssociations(ClassMetadata $class): ClassMetadata { $this->assertEquals(3, count($class->associationMappings)); @@ -304,7 +308,7 @@ public function testAssociations(ClassMetadata $class) /** * @depends testAssociations */ - public function testOwningOneToOneAssociation(ClassMetadata $class) + public function testOwningOneToOneAssociation(ClassMetadata $class): ClassMetadata { $this->assertTrue(isset($class->associationMappings['address'])); $this->assertTrue($class->associationMappings['address']['isOwningSide']); @@ -322,7 +326,7 @@ public function testOwningOneToOneAssociation(ClassMetadata $class) /** * @depends testOwningOneToOneAssociation */ - public function testInverseOneToManyAssociation(ClassMetadata $class) + public function testInverseOneToManyAssociation(ClassMetadata $class): ClassMetadata { $this->assertTrue(isset($class->associationMappings['phonenumbers'])); $this->assertFalse($class->associationMappings['phonenumbers']['isOwningSide']); @@ -342,7 +346,7 @@ public function testInverseOneToManyAssociation(ClassMetadata $class) /** * @depends testInverseOneToManyAssociation */ - public function testManyToManyAssociationWithCascadeAll(ClassMetadata $class) + public function testManyToManyAssociationWithCascadeAll(ClassMetadata $class): ClassMetadata { $this->assertTrue(isset($class->associationMappings['groups'])); $this->assertTrue($class->associationMappings['groups']['isOwningSide']); @@ -361,7 +365,7 @@ public function testManyToManyAssociationWithCascadeAll(ClassMetadata $class) /** * @depends testManyToManyAssociationWithCascadeAll */ - public function testLifecycleCallbacks(ClassMetadata $class) + public function testLifecycleCallbacks(ClassMetadata $class): ClassMetadata { $this->assertEquals(count($class->lifecycleCallbacks), 2); $this->assertEquals($class->lifecycleCallbacks['prePersist'][0], 'doStuffOnPrePersist'); @@ -373,7 +377,7 @@ public function testLifecycleCallbacks(ClassMetadata $class) /** * @depends testManyToManyAssociationWithCascadeAll */ - public function testLifecycleCallbacksSupportMultipleMethodNames(ClassMetadata $class) + public function testLifecycleCallbacksSupportMultipleMethodNames(ClassMetadata $class): ClassMetadata { $this->assertEquals(count($class->lifecycleCallbacks['prePersist']), 2); $this->assertEquals($class->lifecycleCallbacks['prePersist'][1], 'doOtherStuffOnPrePersistToo'); @@ -384,7 +388,7 @@ public function testLifecycleCallbacksSupportMultipleMethodNames(ClassMetadata $ /** * @depends testLifecycleCallbacksSupportMultipleMethodNames */ - public function testJoinColumnUniqueAndNullable(ClassMetadata $class) + public function testJoinColumnUniqueAndNullable(ClassMetadata $class): ClassMetadata { // Non-Nullability of Join Column $this->assertFalse($class->associationMappings['groups']['joinTable']['joinColumns'][0]['nullable']); @@ -396,7 +400,7 @@ public function testJoinColumnUniqueAndNullable(ClassMetadata $class) /** * @depends testJoinColumnUniqueAndNullable */ - public function testColumnDefinition(ClassMetadata $class) + public function testColumnDefinition(ClassMetadata $class): ClassMetadata { $this->assertEquals('CHAR(32) NOT NULL', $class->fieldMappings['email']['columnDefinition']); $this->assertEquals('INT NULL', $class->associationMappings['groups']['joinTable']['inverseJoinColumns'][0]['columnDefinition']); @@ -407,7 +411,7 @@ public function testColumnDefinition(ClassMetadata $class) /** * @depends testColumnDefinition */ - public function testJoinColumnOnDelete(ClassMetadata $class) + public function testJoinColumnOnDelete(ClassMetadata $class): ClassMetadata { $this->assertEquals('CASCADE', $class->associationMappings['address']['joinColumns'][0]['onDelete']); @@ -436,7 +440,7 @@ public function testDiscriminatorColumnDefaults(): void */ public function testMappedSuperclassWithRepository(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $class = $factory->getMetadataFor(DDC869CreditCardPayment::class); @@ -512,7 +516,7 @@ public function testIdentifierColumnDefinition(): void */ public function testNamingStrategy(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $this->assertInstanceOf(DefaultNamingStrategy::class, $em->getConfiguration()->getNamingStrategy()); @@ -567,7 +571,7 @@ public function testIdentifierRequiredShouldMentionParentClasses(): void public function testNamedQuery(): void { - $driver = $this->_loadDriver(); + $driver = $this->loadDriver(); $class = $this->createClassMetadata(User::class); $this->assertCount(1, $class->getNamedQueries(), sprintf('Named queries not processed correctly by driver %s', get_class($driver))); @@ -692,7 +696,7 @@ public function testSqlResultSetMapping(): void $this->assertEquals($personMetadata->name, $mapping['entities'][0]['entityClass']); } - /* + /** * @group DDC-964 */ public function testAssociationOverridesMapping(): void @@ -770,7 +774,7 @@ public function testAssociationOverridesMapping(): void $this->assertEquals(['id' => 'adminaddress_id'], $adminAddress['targetToSourceKeyColumns']); } - /* + /** * @group DDC-3579 */ public function testInversedByOverrideMapping(): void @@ -839,7 +843,7 @@ public function testAttributeOverridesMapping(): void */ public function testEntityListeners(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $superClass = $factory->getMetadataFor(CompanyContract::class); $flexClass = $factory->getMetadataFor(CompanyFixContract::class); @@ -870,7 +874,7 @@ public function testEntityListeners(): void */ public function testEntityListenersOverride(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $ultraClass = $factory->getMetadataFor(CompanyFlexUltraContract::class); @@ -903,7 +907,7 @@ public function testEntityListenersOverride(): void */ public function testEntityListenersNamingConvention(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $metadata = $factory->getMetadataFor(CmsAddress::class); @@ -958,7 +962,7 @@ public function testEntityListenersNamingConvention(): void */ public function testSecondLevelCacheMapping(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $factory = $this->createClassMetadataFactory($em); $class = $factory->getMetadataFor(City::class); $this->assertArrayHasKey('usage', $class->cache); @@ -1070,6 +1074,7 @@ public function testDiscriminatorColumnDefaultName(): void class User { /** + * @var int * @Id * @Column(type="integer", options={"foo": "bar", "unsigned": false}) * @generatedValue(strategy="AUTO") @@ -1077,25 +1082,34 @@ class User **/ public $id; - /** @Column(length=50, nullable=true, unique=true, options={"foo": "bar", "baz": {"key": "val"}, "fixed": false}) */ + /** + * @var string + * @Column(length=50, nullable=true, unique=true, options={"foo": "bar", "baz": {"key": "val"}, "fixed": false}) + */ public $name; - /** @Column(name="user_email", columnDefinition="CHAR(32) NOT NULL") */ + /** + * @var string + * @Column(name="user_email", columnDefinition="CHAR(32) NOT NULL") + */ public $email; /** + * @var Address * @OneToOne(targetEntity="Address", cascade={"remove"}, inversedBy="user") * @JoinColumn(onDelete="CASCADE") */ public $address; /** + * @var Collection * @OneToMany(targetEntity="Phonenumber", mappedBy="user", cascade={"persist"}, orphanRemoval=true) * @OrderBy({"number"="ASC"}) */ public $phonenumbers; /** + * @var Collection * @ManyToMany(targetEntity="Group", cascade={"all"}) * @JoinTable(name="cms_user_groups", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id", nullable=false, unique=false)}, @@ -1105,6 +1119,7 @@ class User public $groups; /** + * @var int * @Column(type="integer") * @Version */ @@ -1279,7 +1294,10 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void abstract class Animal { /** - * @Id @Column(type="string") @GeneratedValue(strategy="CUSTOM") + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="CUSTOM") * @CustomIdGenerator(class="stdClass") */ public $id; @@ -1312,19 +1330,23 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void */ class DDC1170Entity { - function __construct(?string $value = null) + public function __construct(?string $value = null) { $this->value = $value; } /** + * @var int * @Id * @GeneratedValue(strategy="NONE") * @Column(type="integer", columnDefinition = "INT unsigned NOT NULL") - **/ + */ private $id; - /** @Column(columnDefinition = "VARCHAR(255) NOT NULL") */ + /** + * @var string|null + * @Column(columnDefinition = "VARCHAR(255) NOT NULL") + */ private $value; public function getId(): int @@ -1332,7 +1354,7 @@ public function getId(): int return $this->id; } - public function getValue(): string + public function getValue(): ?string { return $this->value; } @@ -1367,6 +1389,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void class DDC807Entity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="NONE") @@ -1417,7 +1440,10 @@ class Group */ class Comment { - /** @Column(type="text") */ + /** + * @var string + * @Column(type="text") + */ private $content; public static function loadMetadata(ClassMetadataInfo $metadata): void @@ -1457,6 +1483,7 @@ public static function loadMetadata(ClassMetadataInfo $metadata): void class SingleTableEntityNoDiscriminatorColumnMapping { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="NONE") @@ -1495,6 +1522,7 @@ class SingleTableEntityNoDiscriminatorColumnMappingSub2 extends SingleTableEntit class SingleTableEntityIncompleteDiscriminatorColumnMapping { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php index 78674adfb63..dda2092c3cd 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php @@ -40,7 +40,7 @@ public function testFailingSecondLevelCacheAssociation(): void { $this->expectException('Doctrine\ORM\Cache\CacheException'); $this->expectExceptionMessage('Entity association field "Doctrine\Tests\ORM\Mapping\AnnotationSLC#foo" not configured as part of the second-level cache.'); - $mappingDriver = $this->_loadDriver(); + $mappingDriver = $this->loadDriver(); $class = new ClassMetadata(AnnotationSLC::class); $mappingDriver->loadMetadataForClass(AnnotationSLC::class, $class); @@ -53,7 +53,7 @@ public function testColumnWithMissingTypeDefaultsToString(): void { $cm = new ClassMetadata(ColumnWithoutType::class); $cm->initializeReflection(new RuntimeReflectionService()); - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); $annotationDriver->loadMetadataForClass(Mapping\InvalidColumn::class, $cm); $this->assertEquals('string', $cm->fieldMappings['id']['type']); @@ -64,10 +64,10 @@ public function testColumnWithMissingTypeDefaultsToString(): void */ public function testGetAllClassNamesIsIdempotent(): void { - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $original = $annotationDriver->getAllClassNames(); - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $afterTestReset = $annotationDriver->getAllClassNames(); $this->assertEquals($original, $afterTestReset); @@ -78,10 +78,10 @@ public function testGetAllClassNamesIsIdempotent(): void */ public function testGetAllClassNamesIsIdempotentEvenWithDifferentDriverInstances(): void { - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $original = $annotationDriver->getAllClassNames(); - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $afterTestReset = $annotationDriver->getAllClassNames(); $this->assertEquals($original, $afterTestReset); @@ -92,9 +92,9 @@ public function testGetAllClassNamesIsIdempotentEvenWithDifferentDriverInstances */ public function testGetAllClassNamesReturnsAlreadyLoadedClassesIfAppropriate(): void { - $this->_ensureIsLoaded(CmsUser::class); + $this->ensureIsLoaded(CmsUser::class); - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $classes = $annotationDriver->getAllClassNames(); $this->assertContains(CmsUser::class, $classes); @@ -105,28 +105,31 @@ public function testGetAllClassNamesReturnsAlreadyLoadedClassesIfAppropriate(): */ public function testGetClassNamesReturnsOnlyTheAppropriateClasses(): void { - $this->_ensureIsLoaded(ECommerceCart::class); + $this->ensureIsLoaded(ECommerceCart::class); - $annotationDriver = $this->_loadDriverForCMSModels(); + $annotationDriver = $this->loadDriverForCMSModels(); $classes = $annotationDriver->getAllClassNames(); $this->assertNotContains(ECommerceCart::class, $classes); } - protected function _loadDriverForCMSModels() + protected function loadDriverForCMSModels(): AnnotationDriver { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); $annotationDriver->addPaths([__DIR__ . '/../../Models/CMS/']); return $annotationDriver; } - protected function _loadDriver(): MappingDriver + protected function loadDriver(): MappingDriver { return $this->createAnnotationDriver(); } - protected function _ensureIsLoaded($entityClassName): void + /** + * @psalm-var class-string $entityClassName + */ + protected function ensureIsLoaded(string $entityClassName): void { new $entityClassName(); } @@ -138,10 +141,10 @@ protected function _ensureIsLoaded($entityClassName): void */ public function testJoinTablesWithMappedSuperclassForAnnotationDriver(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); $annotationDriver->addPaths([__DIR__ . '/../../Models/DirectoryTree/']); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); @@ -158,9 +161,9 @@ public function testJoinTablesWithMappedSuperclassForAnnotationDriver(): void */ public function testInvalidMappedSuperClassWithManyToManyAssociation(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); @@ -179,9 +182,9 @@ public function testInvalidMappedSuperClassWithManyToManyAssociation(): void */ public function testInvalidMappedSuperClassWithInheritanceInformation(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); @@ -200,9 +203,9 @@ public function testInvalidMappedSuperClassWithInheritanceInformation(): void */ public function testInheritanceSkipsParentLifecycleCallbacks(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); @@ -219,9 +222,9 @@ public function testInheritanceSkipsParentLifecycleCallbacks(): void */ public function testMappedSuperclassInMiddleOfInheritanceHierarchy(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); @@ -232,9 +235,9 @@ public function testMappedSuperclassInMiddleOfInheritanceHierarchy(): void public function testInvalidFetchOptionThrowsException(): void { - $annotationDriver = $this->_loadDriver(); + $annotationDriver = $this->loadDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); @@ -265,6 +268,7 @@ public function testAttributeOverridesMappingWithTrait(): void class ColumnWithoutType { /** + * @var int * @Id * @Column */ @@ -276,7 +280,10 @@ class ColumnWithoutType */ class InvalidMappedSuperClass { - /** @ManyToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", mappedBy="invalid") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", mappedBy="invalid") + */ private $users; } @@ -285,7 +292,12 @@ class InvalidMappedSuperClass */ class UsingInvalidMappedSuperClass extends InvalidMappedSuperClass { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; } @@ -306,7 +318,12 @@ class MappedSuperClassInheritence */ class AnnotationParent { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @@ -339,7 +356,11 @@ class AnnotationChild extends AnnotationParent */ class SuperEntity { - /** @Id @Column(type="string") */ + /** + * @var string + * @Id + * @Column(type="string") + */ private $id; } @@ -372,7 +393,10 @@ class ChildEntity extends MiddleMappedSuperclass */ class InvalidFetchOption { - /** @OneToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", fetch="eager") */ + /** + * @var CmsUser + * @OneToMany(targetEntity="Doctrine\Tests\Models\CMS\CmsUser", fetch="eager") + */ private $collection; } @@ -383,6 +407,7 @@ class InvalidFetchOption class AnnotationSLC { /** + * @var AnnotationSLCFoo * @Id * @ManyToOne(targetEntity="AnnotationSLCFoo") */ diff --git a/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php index c1e0a1ef61e..d162f8b3df2 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AnsiQuoteStrategyTest.php @@ -31,7 +31,7 @@ protected function setUp(): void { parent::setUp(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $this->platform = $em->getConnection()->getDatabasePlatform(); $this->strategy = new AnsiQuoteStrategy(); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index 21424b4476a..a21e0e22715 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -29,7 +29,7 @@ protected function setUp(): void { $this->cmf = new ClassMetadataFactory(); - $this->cmf->setEntityManager($this->_getTestEntityManager()); + $this->cmf->setEntityManager($this->getTestEntityManager()); } public function testGetMetadataForTransientClassThrowsException(): void diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php index e951c6de851..4cd8434b25a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php @@ -15,7 +15,7 @@ class ClassMetadataLoadEventTest extends OrmTestCase */ public function testEvent(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $metadataFactory = $em->getMetadataFactory(); $evm = $em->getEventManager(); $evm->addEventListener(Events::loadClassMetadata, $this); diff --git a/tests/Doctrine/Tests/ORM/Mapping/DefaultQuoteStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/DefaultQuoteStrategyTest.php index 689eb99646c..8d063c161ab 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/DefaultQuoteStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/DefaultQuoteStrategyTest.php @@ -22,7 +22,7 @@ class DefaultQuoteStrategyTest extends OrmTestCase */ public function testGetJoinTableName(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $metadata = $em->getClassMetadata(NonPublicSchemaUser::class); $strategy = new DefaultQuoteStrategy(); $platform = $this->getMockForAbstractClass(AbstractPlatform::class); diff --git a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php index 28acde5497c..476cc8c8228 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/PHPMappingDriverTest.php @@ -14,7 +14,7 @@ class PHPMappingDriverTest extends AbstractMappingDriverTest { - protected function _loadDriver(): MappingDriver + protected function loadDriver(): MappingDriver { $path = __DIR__ . DIRECTORY_SEPARATOR . 'php'; @@ -44,7 +44,7 @@ public function testFailingSecondLevelCacheAssociation(): void { $this->expectException('Doctrine\ORM\Cache\CacheException'); $this->expectExceptionMessage('Entity association field "Doctrine\Tests\ORM\Mapping\PHPSLC#foo" not configured as part of the second-level cache.'); - $mappingDriver = $this->_loadDriver(); + $mappingDriver = $this->loadDriver(); $class = new ClassMetadata(Mapping\PHPSLC::class); $mappingDriver->loadMetadataForClass(Mapping\PHPSLC::class, $class); diff --git a/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php b/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php index 1c2dd4ea1d3..73ad972b334 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/QuoteStrategyTest.php @@ -29,7 +29,7 @@ class QuoteStrategyTest extends OrmTestCase protected function setUp(): void { parent::setUp(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $this->platform = $em->getConnection()->getDatabasePlatform(); $this->strategy = new DefaultQuoteStrategy(); } @@ -44,7 +44,7 @@ private function createClassMetadata(string $className): ClassMetadata public function testConfiguration(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $config = $em->getConfiguration(); $this->assertInstanceOf(QuoteStrategy::class, $config->getQuoteStrategy()); diff --git a/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php index 21db295c1f2..b0d2e4193ee 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/StaticPHPMappingDriverTest.php @@ -13,7 +13,7 @@ class StaticPHPMappingDriverTest extends AbstractMappingDriverTest { - protected function _loadDriver(): MappingDriver + protected function loadDriver(): MappingDriver { return new StaticPHPDriver(__DIR__ . DIRECTORY_SEPARATOR . 'php'); } diff --git a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php index 60cbdc64b44..23e94563ab6 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php @@ -33,14 +33,14 @@ class XmlMappingDriverTest extends AbstractMappingDriverTest { - protected function _loadDriver(): MappingDriver + protected function loadDriver(): MappingDriver { return new XmlDriver(__DIR__ . DIRECTORY_SEPARATOR . 'xml'); } public function testClassTableInheritanceDiscriminatorMap(): void { - $mappingDriver = $this->_loadDriver(); + $mappingDriver = $this->loadDriver(); $class = new ClassMetadata(CTI::class); $class->initializeReflection(new RuntimeReflectionService()); @@ -60,7 +60,7 @@ public function testFailingSecondLevelCacheAssociation(): void { $this->expectException('Doctrine\ORM\Cache\CacheException'); $this->expectExceptionMessage('Entity association field "Doctrine\Tests\ORM\Mapping\XMLSLC#foo" not configured as part of the second-level cache.'); - $mappingDriver = $this->_loadDriver(); + $mappingDriver = $this->loadDriver(); $class = new ClassMetadata(XMLSLC::class); $mappingDriver->loadMetadataForClass(XMLSLC::class, $class); @@ -68,8 +68,8 @@ public function testFailingSecondLevelCacheAssociation(): void public function testIdentifierWithAssociationKey(): void { - $driver = $this->_loadDriver(); - $em = $this->_getTestEntityManager(); + $driver = $this->loadDriver(); + $em = $this->getTestEntityManager(); $factory = new ClassMetadataFactory(); $em->getConfiguration()->setMetadataDriverImpl($driver); @@ -99,9 +99,9 @@ public function testEmbeddableMapping(): void public function testEmbeddedMappingsWithUseColumnPrefix(): void { $factory = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); - $em->getConfiguration()->setMetadataDriverImpl($this->_loadDriver()); + $em->getConfiguration()->setMetadataDriverImpl($this->loadDriver()); $factory->setEntityManager($em); $this->assertEquals( @@ -119,9 +119,9 @@ public function testEmbeddedMappingsWithUseColumnPrefix(): void public function testEmbeddedMappingsWithFalseUseColumnPrefix(): void { $factory = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); - $em->getConfiguration()->setMetadataDriverImpl($this->_loadDriver()); + $em->getConfiguration()->setMetadataDriverImpl($this->loadDriver()); $factory->setEntityManager($em); $this->assertFalse( @@ -190,7 +190,7 @@ public static function dataValidSchema() */ public function testOneToManyDefaultOrderByAsc(): void { - $driver = $this->_loadDriver(); + $driver = $this->loadDriver(); $class = new ClassMetadata(GH7141Article::class); $class->initializeReflection(new RuntimeReflectionService()); @@ -207,7 +207,7 @@ public function testManyToManyDefaultOrderByAsc(): void $class = new ClassMetadata(GH7316Article::class); $class->initializeReflection(new RuntimeReflectionService()); - $driver = $this->_loadDriver(); + $driver = $this->loadDriver(); $driver->loadMetadataForClass(GH7316Article::class, $class); self::assertEquals( diff --git a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php index 502f07dc448..ce5a6e97b46 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php @@ -22,7 +22,7 @@ class YamlMappingDriverTest extends AbstractMappingDriverTest { use VerifyDeprecations; - protected function _loadDriver(): MappingDriver + protected function loadDriver(): MappingDriver { if (! class_exists(Yaml::class, true)) { $this->markTestSkipped('Please install Symfony YAML Component into the include path of your PHP installation.'); @@ -38,10 +38,10 @@ protected function _loadDriver(): MappingDriver */ public function testJoinTablesWithMappedSuperclassForYamlDriver(): void { - $yamlDriver = $this->_loadDriver(); + $yamlDriver = $this->loadDriver(); $yamlDriver->getLocator()->addPaths([__DIR__ . DIRECTORY_SEPARATOR . 'yaml']); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($yamlDriver); $factory = new ClassMetadataFactory(); $factory->setEntityManager($em); diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php index f515f216efa..1397b1ce33b 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { parent::setUp(); - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); $this->_em->getClassMetadata(Country::class); $this->_em->getClassMetadata(Admin1::class); diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php index 5268ba72953..b59ede6eacc 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php @@ -22,7 +22,7 @@ protected function setUp(): void { parent::setUp(); - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); $this->_persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(Admin1AlternateName::class)); } diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index de96cf7f950..c6d0c6634eb 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -39,7 +39,7 @@ protected function setUp(): void DBALType::addType('upper_case_string', '\Doctrine\Tests\DbalTypes\UpperCaseStringType'); } - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); $this->_persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(CustomTypeParent::class)); } diff --git a/tests/Doctrine/Tests/ORM/Persisters/JoinedSubclassPersisterTest.php b/tests/Doctrine/Tests/ORM/Persisters/JoinedSubclassPersisterTest.php index 604e3e2d3af..81873272e1b 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/JoinedSubclassPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/JoinedSubclassPersisterTest.php @@ -26,7 +26,7 @@ protected function setUp(): void { parent::setUp(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->persister = new JoinedSubclassPersister($this->em, $this->em->getClassMetadata(RootClass::class)); } diff --git a/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php b/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php index 18dcdd9a34e..05231c109d5 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/ManyToManyPersisterTest.php @@ -32,7 +32,7 @@ public function testDeleteManyToManyCollection(): void $parent->children->add($child); $child->parents->add($parent); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->persist($parent); $em->flush(); diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php index 28f057f72f7..9a42cda11be 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php @@ -21,7 +21,7 @@ class CustomTreeWalkersJoinTest extends OrmTestCase protected function setUp(): void { - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); } public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php index 41fb9b88c2a..b54861adba6 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php @@ -25,7 +25,7 @@ class CustomTreeWalkersTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } public function generateSql($dqlToBeTested, $treeWalkers, $outputWalker) diff --git a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php index 7064032e46b..5c0e8421cf3 100644 --- a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php @@ -22,7 +22,7 @@ class DeleteSqlGenerationTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void diff --git a/tests/Doctrine/Tests/ORM/Query/ExprTest.php b/tests/Doctrine/Tests/ORM/Query/ExprTest.php index 4c449451d75..9b73052d6a1 100644 --- a/tests/Doctrine/Tests/ORM/Query/ExprTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ExprTest.php @@ -24,7 +24,7 @@ class ExprTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); $this->_expr = new Expr(); } diff --git a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php index 323e95990f3..04dbd38c3bf 100644 --- a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php @@ -19,7 +19,7 @@ class FilterCollectionTest extends OrmTestCase protected function setUp(): void { - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->em->getConfiguration()->addFilter('testFilter', MyFilter::class); } diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index 9b740bbf221..4d2da455f41 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -19,7 +19,7 @@ class LanguageRecognitionTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } public function assertValidDQL($dql, $debug = false): void diff --git a/tests/Doctrine/Tests/ORM/Query/ParserTest.php b/tests/Doctrine/Tests/ORM/Query/ParserTest.php index bc2a277d56b..70d22de8bfb 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParserTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParserTest.php @@ -145,7 +145,7 @@ public function invalidMatches() */ public function testNullLookahead(): void { - $query = new Query($this->_getTestEntityManager()); + $query = new Query($this->getTestEntityManager()); $query->setDQL('SELECT CURRENT_TIMESTAMP()'); $parser = new Parser($query); @@ -156,7 +156,7 @@ public function testNullLookahead(): void private function createParser($dql) { - $query = new Query($this->_getTestEntityManager()); + $query = new Query($this->getTestEntityManager()); $query->setDQL($dql); $parser = new Parser($query); diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index ddbf151b8c4..1afa1abe3c7 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -35,7 +35,7 @@ class QueryTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } public function testGetParameters(): void diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index 52af63b9beb..82ff47f40ff 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -11,8 +11,10 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Platforms\SQLServerPlatform; use Doctrine\DBAL\Types\Type as DBALType; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query as ORMQuery; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\SimpleArithmeticExpression; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\QueryException; @@ -30,11 +32,12 @@ class SelectSqlGenerationTest extends OrmTestCase { + /** @var EntityManagerInterface */ private $_em; protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } /** @@ -43,8 +46,12 @@ protected function setUp(): void * @param array $queryHints * @param array $queryParams */ - public function assertSqlGeneration(string $dqlToBeTested, string $sqlToBeConfirmed, array $queryHints = [], array $queryParams = []): void - { + public function assertSqlGeneration( + string $dqlToBeTested, + string $sqlToBeConfirmed, + array $queryHints = [], + array $queryParams = [] + ): void { try { $query = $this->_em->createQuery($dqlToBeTested); @@ -79,8 +86,12 @@ public function assertSqlGeneration(string $dqlToBeTested, string $sqlToBeConfir * @param array $queryHints * @param array $queryParams */ - public function assertInvalidSqlGeneration(string $dqlToBeTested, string $expectedException, array $queryHints = [], array $queryParams = []): void - { + public function assertInvalidSqlGeneration( + string $dqlToBeTested, + string $expectedException, + array $queryHints = [], + array $queryParams = [] + ): void { $this->expectException($expectedException); $query = $this->_em->createQuery($dqlToBeTested); @@ -382,7 +393,7 @@ public function testSupportsAggregateFunctionInASelectDistinct(): void ); } - // Ticket #668 + /** Ticket #668 */ public function testSupportsASqlKeywordInAStringLiteralParam(): void { $this->assertSqlGeneration( @@ -446,7 +457,7 @@ public function testSupportsJoinAndWithClauseRestriction(): void * @group DDC-135 * @group DDC-177 */ - public function testJoinOnClause_NotYetSupported_ThrowsException(): void + public function testJoinOnClauseNotYetSupportedThrowsException(): void { $this->expectException(QueryException::class); @@ -482,7 +493,7 @@ public function testSupportsTrimLeadingZeroString(): void ); } - // Ticket 894 + /** Ticket 894 */ public function testSupportsBetweenClauseWithPositionalParameters(): void { $this->assertSqlGeneration( @@ -577,7 +588,7 @@ public function testSupportsInstanceOfExpressionsUsingInputParameterInWherePart( ); } - // Ticket #973 + /** Ticket #973 */ public function testSupportsSingleValuedInExpressionWithoutSpacesInWherePart(): void { $this->assertSqlGeneration( @@ -972,9 +983,11 @@ public function testSingleValuedAssociationNullCheckOnOwningSide(): void ); } - // Null check on inverse side has to happen through explicit JOIN. - // "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.address IS NULL" - // where the CmsUser is the inverse side is not supported. + /** + * Null check on inverse side has to happen through explicit JOIN. + * "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.address IS NULL" + * where the CmsUser is the inverse side is not supported. + */ public function testSingleValuedAssociationNullCheckOnInverseSide(): void { $this->assertSqlGeneration( @@ -1619,7 +1632,7 @@ public function testAliasDoesNotExceedPlatformDefinedLength(): void { $this->assertSqlGeneration( 'SELECT m FROM ' . __NAMESPACE__ . '\\DDC1384Model m', - 'SELECT d0_.aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalker_fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo AS ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo_0 FROM DDC1384Model d0_' + 'SELECT d0_.aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalkerFooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo AS ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo_0 FROM DDC1384Model d0_' ); } @@ -2327,7 +2340,7 @@ public function testHavingRegressionUsingVariableWithMathOperatorsExpression($op } /** - * @return array + * @psalm-return list */ public function mathematicOperatorsProvider(): array { @@ -2337,12 +2350,13 @@ public function mathematicOperatorsProvider(): array class MyAbsFunction extends FunctionNode { + /** @var SimpleArithmeticExpression */ public $simpleArithmeticExpression; /** * @override */ - public function getSql(SqlWalker $sqlWalker) + public function getSql(SqlWalker $sqlWalker): string { return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) . ')'; } @@ -2368,11 +2382,12 @@ public function parse(Parser $parser): void class DDC1384Model { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ - protected $aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalker_fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo; + protected $aVeryLongIdentifierThatShouldBeShortenedByTheSQLWalkerFooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo; } @@ -2382,13 +2397,17 @@ class DDC1384Model class DDC1474Entity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue() */ protected $id; - /** @column(type="float") */ + /** + * @var float + * @column(type="float") + */ private $value; public function __construct(string $float) diff --git a/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php b/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php index 67ede42a486..1bbb397b11e 100644 --- a/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SqlWalkerTest.php @@ -21,7 +21,7 @@ class SqlWalkerTest extends OrmTestCase protected function setUp(): void { - $this->sqlWalker = new SqlWalker(new Query($this->_getTestEntityManager()), new ParserResult(), []); + $this->sqlWalker = new SqlWalker(new Query($this->getTestEntityManager()), new ParserResult(), []); } /** diff --git a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php index e0ac0620358..a6537d32d74 100644 --- a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php @@ -30,7 +30,7 @@ protected function setUp(): void DBALType::addType('negative_to_positive', NegativeToPositiveType::class); } - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void diff --git a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php index b6d6527f4f4..3622afcf7ab 100644 --- a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php @@ -34,7 +34,7 @@ class QueryBuilderTest extends OrmTestCase protected function setUp(): void { - $this->_em = $this->_getTestEntityManager(); + $this->_em = $this->getTestEntityManager(); } protected function assertValidQueryBuilder(QueryBuilder $qb, $expectedDql): void diff --git a/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php index 1452e8c450f..a3207a791db 100644 --- a/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php @@ -27,7 +27,7 @@ protected function setUp(): void { $this->listener = new AttachEntityListenersListener(); $driver = $this->createAnnotationDriver(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $evm = $this->em->getEventManager(); $this->factory = new ClassMetadataFactory(); diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php index d7d11308afe..c5d4997662a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php @@ -25,7 +25,7 @@ protected function setUp(): void parent::setUp(); $driver = $this->createAnnotationDriver(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getConfiguration()->setMetadataDriverImpl($driver); diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index 6a47fe15ca0..fe6645b7b8b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -806,7 +806,7 @@ public function testEntityTypeAlias(array $field): void public function testTraitPropertiesAndMethodsAreNotDuplicated(): void { $cmf = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $cmf->setEntityManager($em); $user = new DDC2372User(); @@ -832,7 +832,7 @@ public function testTraitPropertiesAndMethodsAreNotDuplicated(): void public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses(): void { $cmf = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $cmf->setEntityManager($em); $user = new DDC2372Admin(); @@ -858,7 +858,7 @@ public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses(): v public function testMethodsAndPropertiesAreNotDuplicatedInChildClasses(): void { $cmf = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $cmf->setEntityManager($em); diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php index d88592dbd59..1bca8a7f136 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php @@ -92,7 +92,7 @@ public function ensureTestGeneratedDeprecationMessages(): void */ public function testGeneratedEntityRepositoryClass(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $ns = $this->_namespace; $className = $ns . '\DDC3231User1Tmp'; @@ -133,7 +133,7 @@ public function testGeneratedEntityRepositoryClass(): void */ public function testGeneratedEntityRepositoryClassCustomDefaultRepository(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $ns = $this->_namespace; $className = $ns . '\DDC3231User2Tmp'; @@ -174,7 +174,7 @@ public function testGeneratedEntityRepositoryClassCustomDefaultRepository(): voi private function writeEntityClass(string $className, string $newClassName): void { $cmf = new ClassMetadataFactory(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $cmf->setEntityManager($em); diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php index 18077c2436a..2a2800e4a46 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php @@ -15,7 +15,7 @@ abstract class PaginationTestCase extends OrmTestCase protected function setUp(): void { - $this->entityManager = $this->_getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php index 4b3df4310e4..ea0cc2f8296 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginatorTest.php @@ -31,7 +31,7 @@ protected function setUp(): void ->getMock(); $this->em = $this->getMockBuilder(EntityManagerDecorator::class) - ->setConstructorArgs([$this->_getTestEntityManager($this->connection)]) + ->setConstructorArgs([$this->getTestEntityManager($this->connection)]) ->setMethods(['newHydrator']) ->getMock(); diff --git a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php index a1d6433eeea..7c2606f4a88 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php @@ -25,7 +25,7 @@ protected function setUp(): void { $annotationDriver = $this->createAnnotationDriver(); - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->em->getConfiguration()->setMetadataDriverImpl($annotationDriver); $this->factory = $this->em->getMetadataFactory(); $this->listener = new ResolveTargetEntityListener(); diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index 69eb54dd722..15184770f2e 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -32,7 +32,7 @@ class SchemaToolTest extends OrmTestCase { public function testAddUniqueIndexForUniqueFieldAnnotation(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $classes = [ @@ -53,7 +53,7 @@ public function testAddUniqueIndexForUniqueFieldAnnotation(): void public function testAnnotationOptionsAttribute(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $schema = $schemaTool->getSchemaFromMetadata( @@ -76,7 +76,7 @@ public function testPassColumnDefinitionToJoinColumn(): void { $customColumnDef = 'MEDIUMINT(6) UNSIGNED NOT NULL'; - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $avatar = $em->getClassMetadata(ForumAvatar::class); @@ -98,7 +98,7 @@ public function testPassColumnDefinitionToJoinColumn(): void */ public function testPassColumnOptionsToJoinColumn(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $category = $em->getClassMetadata(GH6830Category::class); $board = $em->getClassMetadata(GH6830Board::class); @@ -138,7 +138,7 @@ public function testPostGenerateEvents(): void { $listener = new GenerateSchemaEventListener(); - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $em->getEventManager()->addEventListener( [ToolEvents::postGenerateSchemaTable, ToolEvents::postGenerateSchema], $listener @@ -163,7 +163,7 @@ public function testPostGenerateEvents(): void public function testNullDefaultNotAddedToCustomSchemaOptions(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $customSchemaOptions = $schemaTool->getSchemaFromMetadata([$em->getClassMetadata(NullDefaultColumn::class)]) @@ -179,7 +179,7 @@ public function testNullDefaultNotAddedToCustomSchemaOptions(): void */ public function testSchemaHasProperIndexesFromUniqueConstraintAnnotation(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $classes = [ $em->getClassMetadata(UniqueConstraintAnnotationModel::class), @@ -197,7 +197,7 @@ public function testSchemaHasProperIndexesFromUniqueConstraintAnnotation(): void public function testRemoveUniqueIndexOverruledByPrimaryKey(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $classes = [ $em->getClassMetadata(FirstEntity::class), @@ -216,7 +216,7 @@ public function testRemoveUniqueIndexOverruledByPrimaryKey(): void public function testSetDiscriminatorColumnWithoutLength(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $metadata = $em->getClassMetadata(FirstEntity::class); @@ -236,7 +236,7 @@ public function testSetDiscriminatorColumnWithoutLength(): void public function testDerivedCompositeKey(): void { - $em = $this->_getTestEntityManager(); + $em = $this->getTestEntityManager(); $schemaTool = new SchemaTool($em); $schema = $schemaTool->getSchemaFromMetadata( diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php index 63eb7d1d422..23f1d87ddf7 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php @@ -21,7 +21,7 @@ class SchemaValidatorTest extends OrmTestCase protected function setUp(): void { - $this->em = $this->_getTestEntityManager(); + $this->em = $this->getTestEntityManager(); $this->validator = new SchemaValidator($this->em); } diff --git a/tests/Doctrine/Tests/OrmTestCase.php b/tests/Doctrine/Tests/OrmTestCase.php index 7dfce2feecd..8bd3c8e5833 100644 --- a/tests/Doctrine/Tests/OrmTestCase.php +++ b/tests/Doctrine/Tests/OrmTestCase.php @@ -84,8 +84,12 @@ protected function createAnnotationDriver(array $paths = [], $alias = null): Ann * @param Connection|array $conn * @param mixed $conf */ - protected function _getTestEntityManager($conn = null, $conf = null, ?EventManager $eventManager = null, bool $withSharedMetadata = true): EntityManagerMock - { + protected function getTestEntityManager( + $conn = null, + $conf = null, + ?EventManager $eventManager = null, + bool $withSharedMetadata = true + ): EntityManagerMock { $metadataCache = $withSharedMetadata ? self::getSharedMetadataCacheImpl() : new ArrayCache(); From fb9b9b276e1f9130089996f587f8a9bb01e48008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 8 Feb 2021 09:22:45 +0100 Subject: [PATCH 06/27] Manually fix cs --- .../Doctrine/Tests/Models/CMS/CmsArticle.php | 23 +++- tests/Doctrine/Tests/Models/CMS/CmsGroup.php | 23 +++- tests/Doctrine/Tests/Models/CMS/CmsUser.php | 5 +- .../Tests/Models/Company/CompanyContract.php | 25 +++- .../Tests/Models/Company/CompanyEvent.php | 9 +- .../Models/Company/CompanyOrganization.php | 29 +++-- .../Tests/Models/Company/CompanyPerson.php | 22 +++- .../Tests/ORM/Functional/QueryCacheTest.php | 4 +- .../Tests/ORM/Functional/ResultCacheTest.php | 3 +- .../Tests/ORM/Functional/SQLFilterTest.php | 122 ++++++++++++------ .../ORM/Functional/Ticket/DDC1335Test.php | 24 ++-- .../ORM/Functional/Ticket/DDC1404Test.php | 8 +- .../ORM/Functional/Ticket/DDC1430Test.php | 8 +- .../ORM/Functional/Ticket/DDC440Test.php | 23 ++-- .../ORM/Functional/Ticket/DDC758Test.php | 22 ++-- tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 109 +++++++++++++--- 16 files changed, 320 insertions(+), 139 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php index 8d187bf5b87..9834f42e55c 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsArticle.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsArticle.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\Models\CMS; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @Table(name="cms_articles") @@ -11,12 +13,17 @@ class CmsArticle { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(type="string", length=255) */ + + /** + * @var string + * @Column(type="string", length=255) + */ public $topic; /** @@ -24,15 +31,25 @@ class CmsArticle * @Column(type="text") */ public $text; + /** + * @var CmsUser * @ManyToOne(targetEntity="CmsUser", inversedBy="articles") * @JoinColumn(name="user_id", referencedColumnName="id") */ public $user; - /** @OneToMany(targetEntity="CmsComment", mappedBy="article") */ + + /** + * @var Collection + * @OneToMany(targetEntity="CmsComment", mappedBy="article") + */ public $comments; - /** @Version @column(type="integer") */ + /** + * @var int + * @Version + * @column(type="integer") + */ public $version; public function setAuthor(CmsUser $author): void diff --git a/tests/Doctrine/Tests/Models/CMS/CmsGroup.php b/tests/Doctrine/Tests/Models/CMS/CmsGroup.php index 86e4807163d..70fb878ad4a 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsGroup.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsGroup.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\CMS; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use IteratorAggregate; use Traversable; @@ -17,14 +18,23 @@ class CmsGroup implements IteratorAggregate { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ public $id; - /** @Column(length=50) */ + + /** + * @var string + * @Column(length=50) + */ public $name; - /** @ManyToMany(targetEntity="CmsUser", mappedBy="groups") */ + + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="CmsUser", mappedBy="groups") + */ public $users; public function __construct() @@ -32,12 +42,12 @@ public function __construct() $this->users = new ArrayCollection(); } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } - public function getName() + public function getName(): string { return $this->name; } @@ -47,7 +57,10 @@ public function addUser(CmsUser $user): void $this->users[] = $user; } - public function getUsers() + /** + * @psalm-return Collection + */ + public function getUsers(): Collection { return $this->users; } diff --git a/tests/Doctrine/Tests/Models/CMS/CmsUser.php b/tests/Doctrine/Tests/Models/CMS/CmsUser.php index d417702cc2c..e30f320fd85 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsUser.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsUser.php @@ -122,10 +122,13 @@ class CmsUser { /** - * @Id @Column(type="integer") + * @var int + * @Id + * @Column(type="integer") * @GeneratedValue */ public $id; + /** @Column(type="string", length=50, nullable=true) */ public $status; /** @Column(type="string", length=255, unique=true) */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyContract.php b/tests/Doctrine/Tests/Models/Company/CompanyContract.php index 925f3f665ce..0db4fffc9d6 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyContract.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyContract.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\Company; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; @@ -63,10 +64,18 @@ */ abstract class CompanyContract { - /** @Id @column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @column(type="integer") + * @GeneratedValue + */ private $id; - /** @ManyToOne(targetEntity="CompanyEmployee", inversedBy="soldContracts") */ + /** + * @var CompanyEmployee + * @ManyToOne(targetEntity="CompanyEmployee", inversedBy="soldContracts") + */ private $salesPerson; /** @@ -76,6 +85,7 @@ abstract class CompanyContract private $completed = false; /** + * @psalm-var Collection * @ManyToMany(targetEntity="CompanyEmployee", inversedBy="contracts") * @JoinTable(name="company_contract_employees", * joinColumns={@JoinColumn(name="contract_id", referencedColumnName="id", onDelete="CASCADE")}, @@ -89,7 +99,7 @@ public function __construct() $this->engineers = new ArrayCollection(); } - public function getId() + public function getId(): int { return $this->id; } @@ -99,12 +109,12 @@ public function markCompleted(): void $this->completed = true; } - public function isCompleted() + public function isCompleted(): bool { return $this->completed; } - public function getSalesPerson() + public function getSalesPerson(): CompanyEmployee { return $this->salesPerson; } @@ -114,7 +124,10 @@ public function setSalesPerson(CompanyEmployee $salesPerson): void $this->salesPerson = $salesPerson; } - public function getEngineers() + /** + * @psalm-return Collection + */ + public function getEngineers(): Collection { return $this->engineers; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyEvent.php b/tests/Doctrine/Tests/Models/Company/CompanyEvent.php index c44fcf6cf7d..163a77dd30f 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyEvent.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyEvent.php @@ -13,23 +13,26 @@ abstract class CompanyEvent { /** - * @Id @Column(type="integer") + * @var int + * @Id + * @Column(type="integer") * @GeneratedValue */ private $id; /** + * @var CompanyOrganization * @ManyToOne(targetEntity="CompanyOrganization", inversedBy="events", cascade={"persist"}) * @JoinColumn(name="org_id", referencedColumnName="id") */ private $organization; - public function getId() + public function getId(): int { return $this->id; } - public function getOrganization() + public function getOrganization(): CompanyOrganization { return $this->organization; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php b/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php index 320e11b29e7..f8d4624c7c5 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyOrganization.php @@ -4,24 +4,34 @@ namespace Doctrine\Tests\Models\Company; +use Doctrine\Common\Collections\Collection; + /** @Entity @Table(name="company_organizations") */ class CompanyOrganization { - /** - * @Id @Column(type="integer") - * @GeneratedValue(strategy="AUTO") - */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue(strategy="AUTO") + */ private $id; - /** @OneToMany(targetEntity="CompanyEvent", mappedBy="organization", cascade={"persist"}, fetch="EXTRA_LAZY") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="CompanyEvent", mappedBy="organization", cascade={"persist"}, fetch="EXTRA_LAZY") + */ public $events; - public function getId() + public function getId(): int { return $this->id; } - public function getEvents() + /** + * @psalm-return Collection + */ + public function getEvents(): Collection { return $this->events; } @@ -33,17 +43,18 @@ public function addEvent(CompanyEvent $event): void } /** + * @var CompanyEvent|null * @OneToOne(targetEntity="CompanyEvent", cascade={"persist"}) * @JoinColumn(name="main_event_id", referencedColumnName="id", nullable=true) */ private $mainevent; - public function getMainEvent() + public function getMainEvent(): ?CompanyEvent { return $this->mainevent; } - public function setMainEvent($event): void + public function setMainEvent(CompanyEvent $event): void { $this->mainevent = $event; } diff --git a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php index 63f7dbe8242..d1d91aa39ec 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyPerson.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyPerson.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\Company; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping\ClassMetadataInfo; /** @@ -50,22 +51,28 @@ class CompanyPerson { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ private $id; - /** @Column */ + /** + * @var string + * @Column + */ private $name; /** + * @var CompanyPerson|null * @OneToOne(targetEntity="CompanyPerson") * @JoinColumn(name="spouse_id", referencedColumnName="id", onDelete="CASCADE") */ private $spouse; /** + * @psalm-var Collection * @ManyToMany(targetEntity="CompanyPerson") * @JoinTable( * name="company_persons_friends", @@ -84,27 +91,30 @@ public function __construct() $this->friends = new ArrayCollection(); } - public function getId() + public function getId(): int { return $this->id; } - public function getName() + public function getName(): string { return $this->name; } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } - public function getSpouse() + public function getSpouse(): ?CompanyPerson { return $this->spouse; } - public function getFriends() + /** + * @psalm-return Collection + */ + public function getFriends(): Collection { return $this->friends; } diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php index d2ae7f65043..fb4b330c857 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php @@ -12,7 +12,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; use ReflectionProperty; -use function sizeof; +use function count; /** * QueryCacheTest @@ -34,7 +34,7 @@ protected function setUp(): void private function getCacheSize(ArrayCache $cache): int { - return sizeof($this->cacheDataReflection->getValue($cache)); + return count($this->cacheDataReflection->getValue($cache)); } public function testQueryCache_DependsOnHints() diff --git a/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php index 7910fecbb46..52e57c48154 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php @@ -12,7 +12,6 @@ use ReflectionProperty; use function count; -use function sizeof; /** * ResultCacheTest @@ -32,7 +31,7 @@ protected function setUp(): void private function getCacheSize(ArrayCache $cache): int { - return sizeof($this->cacheDataReflection->getValue($cache)); + return count($this->cacheDataReflection->getValue($cache)); } public function testResultCache(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php index 8c516bdefe4..d451d357512 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Types\Type as DBALType; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\ORM\Query\Filter\SQLFilter; @@ -33,7 +34,6 @@ use function count; use function in_array; use function serialize; -use function sizeof; /** * Tests SQLFilter functionality. @@ -42,10 +42,44 @@ */ class SQLFilterTest extends OrmFunctionalTestCase { - private $userId, $userId2, $articleId, $articleId2; - private $groupId, $groupId2; - private $managerId, $managerId2, $contractId1, $contractId2; - private $organizationId, $eventId1, $eventId2; + /** @var int */ + private $userId; + + /** @var int */ + private $userId2; + + /** @var int */ + private $articleId; + + /** @var int */ + private $articleId2; + + /** @var int */ + private $groupId; + + /** @var int */ + private $groupId2; + + /** @var int */ + private $managerId; + + /** @var int */ + private $managerId2; + + /** @var int */ + private $contractId1; + + /** @var int */ + private $contractId2; + + /** @var int */ + private $organizationId; + + /** @var int */ + private $eventId1; + + /** @var int */ + private $eventId2; protected function setUp(): void { @@ -195,23 +229,19 @@ protected function configureFilters($em): void $config->addFilter('soft_delete', '\Doctrine\Tests\ORM\Functional\MySoftDeleteFilter'); } - protected function getMockConnection() + protected function getMockConnection(): Connection { // Setup connection mock - return $this->getMockBuilder(Connection::class) - ->disableOriginalConstructor() - ->getMock(); + return $this->createMock(Connection::class); } - protected function getMockEntityManager() + protected function getMockEntityManager(): EntityManagerInterface { - // Setup connection mock - return $this->getMockBuilder(EntityManager::class) - ->disableOriginalConstructor() - ->getMock(); + // Setup entity manager mock + return $this->createMock(EntityManager::class); } - protected function addMockFilterCollection($em) + protected function addMockFilterCollection(EntityManagerInterface $em): FilterCollection { $filterCollection = $this->getMockBuilder(FilterCollection::class) ->disableOriginalConstructor() @@ -338,7 +368,7 @@ public function testSQLFilterToString(): void $this->assertEquals('' . $filter, '' . $filter2); } - public function testQueryCache_DependsOnFilters(): void + public function testQueryCacheDependsOnFilters(): void { $cacheDataReflection = new ReflectionProperty(ArrayCache::class, 'data'); $cacheDataReflection->setAccessible(true); @@ -349,21 +379,21 @@ public function testQueryCache_DependsOnFilters(): void $query->setQueryCacheDriver($cache); $query->getResult(); - $this->assertEquals(1, sizeof($cacheDataReflection->getValue($cache))); + $this->assertEquals(1, count($cacheDataReflection->getValue($cache))); $conf = $this->_em->getConfiguration(); $conf->addFilter('locale', '\Doctrine\Tests\ORM\Functional\MyLocaleFilter'); $this->_em->getFilters()->enable('locale'); $query->getResult(); - $this->assertEquals(2, sizeof($cacheDataReflection->getValue($cache))); + $this->assertEquals(2, count($cacheDataReflection->getValue($cache))); // Another time doesn't add another cache entry $query->getResult(); - $this->assertEquals(2, sizeof($cacheDataReflection->getValue($cache))); + $this->assertEquals(2, count($cacheDataReflection->getValue($cache))); } - public function testQueryGeneration_DependsOnFilters(): void + public function testQueryGenerationDependsOnFilters(): void { $query = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a'); $firstSQLQuery = $query->getSQL(); @@ -539,7 +569,7 @@ private function useCMSArticleTopicFilter(): void $this->_em->getFilters()->enable('article_topic')->setParameter('topic', 'Test1', DBALType::STRING); } - public function testOneToMany_ExtraLazyCountWithFilter(): void + public function testOneToManyExtraLazyCountWithFilter(): void { $this->loadLazyFixtureData(); $user = $this->_em->find(CmsUser::class, $this->userId); @@ -552,7 +582,7 @@ public function testOneToMany_ExtraLazyCountWithFilter(): void $this->assertEquals(1, count($user->articles)); } - public function testOneToMany_ExtraLazyContainsWithFilter(): void + public function testOneToManyExtraLazyContainsWithFilter(): void { $this->loadLazyFixtureData(); $user = $this->_em->find(CmsUser::class, $this->userId); @@ -566,7 +596,7 @@ public function testOneToMany_ExtraLazyContainsWithFilter(): void $this->assertFalse($user->articles->contains($filteredArticle)); } - public function testOneToMany_ExtraLazySliceWithFilter(): void + public function testOneToManyExtraLazySliceWithFilter(): void { $this->loadLazyFixtureData(); $user = $this->_em->find(CmsUser::class, $this->userId); @@ -586,7 +616,7 @@ private function useCMSGroupPrefixFilter(): void $this->_em->getFilters()->enable('group_prefix')->setParameter('prefix', 'foo%', DBALType::STRING); } - public function testManyToMany_ExtraLazyCountWithFilter(): void + public function testManyToManyExtraLazyCountWithFilter(): void { $this->loadLazyFixtureData(); @@ -600,7 +630,7 @@ public function testManyToMany_ExtraLazyCountWithFilter(): void $this->assertEquals(1, count($user->groups)); } - public function testManyToMany_ExtraLazyContainsWithFilter(): void + public function testManyToManyExtraLazyContainsWithFilter(): void { $this->loadLazyFixtureData(); $user = $this->_em->find(CmsUser::class, $this->userId2); @@ -614,7 +644,7 @@ public function testManyToMany_ExtraLazyContainsWithFilter(): void $this->assertFalse($user->groups->contains($filteredArticle)); } - public function testManyToMany_ExtraLazySliceWithFilter(): void + public function testManyToManyExtraLazySliceWithFilter(): void { $this->loadLazyFixtureData(); $user = $this->_em->find(CmsUser::class, $this->userId2); @@ -691,7 +721,7 @@ private function loadFixtureData(): void $this->groupId2 = $group2->id; } - public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingSubEntity(): void + public function testJoinSubclassPersisterFilterOnlyOnRootTableWhenFetchingSubEntity(): void { $this->loadCompanyJoinedSubclassFixtureData(); // Persister @@ -709,7 +739,7 @@ public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingSubEn $this->assertEquals(1, count($this->_em->createQuery('SELECT cm FROM Doctrine\Tests\Models\Company\CompanyManager cm')->getResult())); } - public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingRootEntity(): void + public function testJoinSubclassPersisterFilterOnlyOnRootTableWhenFetchingRootEntity(): void { $this->loadCompanyJoinedSubclassFixtureData(); $this->assertEquals(3, count($this->_em->getRepository(CompanyPerson::class)->findAll())); @@ -749,7 +779,7 @@ private function loadCompanyJoinedSubclassFixtureData(): void $this->_em->clear(); } - public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingSubEntity(): void + public function testSingleTableInheritanceFilterOnlyOnRootTableWhenFetchingSubEntity(): void { $this->loadCompanySingleTableInheritanceFixtureData(); // Persister @@ -768,7 +798,7 @@ public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingSubE $this->assertEquals(1, count($this->_em->createQuery('SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract cfc')->getResult())); } - public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingRootEntity(): void + public function testSingleTableInheritanceFilterOnlyOnRootTableWhenFetchingRootEntity(): void { $this->loadCompanySingleTableInheritanceFixtureData(); $this->assertEquals(4, count($this->_em->getRepository(CompanyFlexContract::class)->findAll())); @@ -841,7 +871,7 @@ private function useCompletedContractFilter(): void ->setParameter('completed', true, DBALType::BOOLEAN); } - public function testManyToMany_ExtraLazyCountWithFilterOnSTI(): void + public function testManyToManyExtraLazyCountWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -857,7 +887,7 @@ public function testManyToMany_ExtraLazyCountWithFilterOnSTI(): void $this->assertEquals(2, count($manager->managedContracts)); } - public function testManyToMany_ExtraLazyContainsWithFilterOnSTI(): void + public function testManyToManyExtraLazyContainsWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -877,7 +907,7 @@ public function testManyToMany_ExtraLazyContainsWithFilterOnSTI(): void $this->assertTrue($manager->managedContracts->contains($contract2)); } - public function testManyToMany_ExtraLazySliceWithFilterOnSTI(): void + public function testManyToManyExtraLazySliceWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -903,7 +933,7 @@ private function usePersonNameFilter($name): void ->setParameter('name', $name, DBALType::STRING); } - public function testManyToMany_ExtraLazyCountWithFilterOnCTI(): void + public function testManyToManyExtraLazyCountWithFilterOnCTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -919,7 +949,7 @@ public function testManyToMany_ExtraLazyCountWithFilterOnCTI(): void $this->assertEquals(1, count($contract->managers)); } - public function testManyToMany_ExtraLazyContainsWithFilterOnCTI(): void + public function testManyToManyExtraLazyContainsWithFilterOnCTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -939,7 +969,7 @@ public function testManyToMany_ExtraLazyContainsWithFilterOnCTI(): void $this->assertTrue($contract->managers->contains($manager2)); } - public function testManyToMany_ExtraLazySliceWithFilterOnCTI(): void + public function testManyToManyExtraLazySliceWithFilterOnCTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -955,7 +985,7 @@ public function testManyToMany_ExtraLazySliceWithFilterOnCTI(): void $this->assertEquals(1, count($contract->managers->slice(0, 10))); } - public function testOneToMany_ExtraLazyCountWithFilterOnSTI(): void + public function testOneToManyExtraLazyCountWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -971,7 +1001,7 @@ public function testOneToMany_ExtraLazyCountWithFilterOnSTI(): void $this->assertEquals(1, count($manager->soldContracts)); } - public function testOneToMany_ExtraLazyContainsWithFilterOnSTI(): void + public function testOneToManyExtraLazyContainsWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -991,7 +1021,7 @@ public function testOneToMany_ExtraLazyContainsWithFilterOnSTI(): void $this->assertTrue($manager->soldContracts->contains($contract2)); } - public function testOneToMany_ExtraLazySliceWithFilterOnSTI(): void + public function testOneToManyExtraLazySliceWithFilterOnSTI(): void { $this->loadCompanySingleTableInheritanceFixtureData(); @@ -1039,7 +1069,7 @@ private function useCompanyEventIdFilter(): void ->setParameter('id', $this->eventId2); } - public function testOneToMany_ExtraLazyCountWithFilterOnCTI(): void + public function testOneToManyExtraLazyCountWithFilterOnCTI(): void { $this->loadCompanyOrganizationEventJoinedSubclassFixtureData(); @@ -1055,7 +1085,7 @@ public function testOneToMany_ExtraLazyCountWithFilterOnCTI(): void $this->assertEquals(1, count($organization->events)); } - public function testOneToMany_ExtraLazyContainsWithFilterOnCTI(): void + public function testOneToManyExtraLazyContainsWithFilterOnCTI(): void { $this->loadCompanyOrganizationEventJoinedSubclassFixtureData(); @@ -1076,7 +1106,7 @@ public function testOneToMany_ExtraLazyContainsWithFilterOnCTI(): void $this->assertTrue($organization->events->contains($event2)); } - public function testOneToMany_ExtraLazySliceWithFilterOnCTI(): void + public function testOneToManyExtraLazySliceWithFilterOnCTI(): void { $this->loadCompanyOrganizationEventJoinedSubclassFixtureData(); @@ -1095,6 +1125,7 @@ public function testOneToMany_ExtraLazySliceWithFilterOnCTI(): void class MySoftDeleteFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { if ($targetEntity->name !== 'MyEntity\SoftDeleteNewsItem') { @@ -1107,6 +1138,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class MyLocaleFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { if (! in_array('LocaleAware', $targetEntity->reflClass->getInterfaceNames())) { @@ -1119,6 +1151,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CMSCountryFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { if ($targetEntity->name !== CmsAddress::class) { @@ -1131,6 +1164,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CMSGroupPrefixFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { if ($targetEntity->name !== CmsGroup::class) { @@ -1143,6 +1177,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CMSArticleTopicFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) { if ($targetEntity->name !== CmsArticle::class) { @@ -1155,6 +1190,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CompanyPersonNameFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '') { if ($targetEntity->name !== CompanyPerson::class) { @@ -1167,6 +1203,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CompletedContractFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '') { if ($targetEntity->name !== CompanyContract::class) { @@ -1179,6 +1216,7 @@ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAli class CompanyEventFilter extends SQLFilter { + /** {@inheritDoc} */ public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias, $targetTable = '') { if ($targetEntity->name !== CompanyEvent::class) { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php index 7dbbcdb8810..f9972100c17 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php @@ -8,7 +8,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; use Exception; -use function sizeof; +use function count; /** * @group DDC-1335 @@ -36,7 +36,7 @@ public function testDql(): void $query = $this->_em->createQuery($dql); $result = $query->getResult(); - $this->assertEquals(sizeof($result), 3); + $this->assertEquals(count($result), 3); $this->assertArrayHasKey(1, $result); $this->assertArrayHasKey(2, $result); $this->assertArrayHasKey(3, $result); @@ -45,14 +45,14 @@ public function testDql(): void $query = $this->_em->createQuery($dql); $result = $query->getResult(); - $this->assertEquals(sizeof($result), 3); + $this->assertEquals(count($result), 3); $this->assertArrayHasKey('foo@foo.com', $result); $this->assertArrayHasKey('bar@bar.com', $result); $this->assertArrayHasKey('foobar@foobar.com', $result); - $this->assertEquals(sizeof($result['foo@foo.com']->phones), 3); - $this->assertEquals(sizeof($result['bar@bar.com']->phones), 3); - $this->assertEquals(sizeof($result['foobar@foobar.com']->phones), 3); + $this->assertEquals(count($result['foo@foo.com']->phones), 3); + $this->assertEquals(count($result['bar@bar.com']->phones), 3); + $this->assertEquals(count($result['foobar@foobar.com']->phones), 3); $foo = $result['foo@foo.com']->phones->toArray(); $bar = $result['bar@bar.com']->phones->toArray(); @@ -79,7 +79,7 @@ public function testTicket(): void $dql = $builder->getQuery()->getDQL(); $result = $builder->getQuery()->getResult(); - $this->assertEquals(sizeof($result), 3); + $this->assertEquals(count($result), 3); $this->assertArrayHasKey(1, $result); $this->assertArrayHasKey(2, $result); $this->assertArrayHasKey(3, $result); @@ -94,7 +94,7 @@ public function testIndexByUnique(): void $dql = $builder->getQuery()->getDQL(); $result = $builder->getQuery()->getResult(); - $this->assertEquals(sizeof($result), 3); + $this->assertEquals(count($result), 3); $this->assertArrayHasKey('foo@foo.com', $result); $this->assertArrayHasKey('bar@bar.com', $result); $this->assertArrayHasKey('foobar@foobar.com', $result); @@ -111,14 +111,14 @@ public function testIndexWithJoin(): void $dql = $builder->getQuery()->getDQL(); $result = $builder->getQuery()->getResult(); - $this->assertEquals(sizeof($result), 3); + $this->assertEquals(count($result), 3); $this->assertArrayHasKey('foo@foo.com', $result); $this->assertArrayHasKey('bar@bar.com', $result); $this->assertArrayHasKey('foobar@foobar.com', $result); - $this->assertEquals(sizeof($result['foo@foo.com']->phones), 3); - $this->assertEquals(sizeof($result['bar@bar.com']->phones), 3); - $this->assertEquals(sizeof($result['foobar@foobar.com']->phones), 3); + $this->assertEquals(count($result['foo@foo.com']->phones), 3); + $this->assertEquals(count($result['bar@bar.com']->phones), 3); + $this->assertEquals(count($result['foobar@foobar.com']->phones), 3); $this->assertArrayHasKey(1, $result['foo@foo.com']->phones->toArray()); $this->assertArrayHasKey(2, $result['foo@foo.com']->phones->toArray()); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php index 00e29bb3413..5e2dd53cb56 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php @@ -6,7 +6,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; -use function sizeof; +use function count; /** * @group DDC-1404 @@ -41,9 +41,9 @@ public function testTicket(): void $this->assertEquals('SELECT p FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1404ChildEntity p WHERE p.id = 1', $queryFirst->getDQL()); $this->assertEquals('SELECT p FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1404ChildEntity p WHERE p.id = 2', $querySecond->getDQL()); - $this->assertEquals(sizeof($queryAll->getResult()), 2); - $this->assertEquals(sizeof($queryFirst->getResult()), 1); - $this->assertEquals(sizeof($querySecond->getResult()), 1); + $this->assertEquals(count($queryAll->getResult()), 2); + $this->assertEquals(count($queryFirst->getResult()), 1); + $this->assertEquals(count($querySecond->getResult()), 1); } public function loadFixtures(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php index bd50eb57a59..9cecdb66c33 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php @@ -9,7 +9,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; use Exception; -use function sizeof; +use function count; /** * @group DDC-1430 @@ -47,7 +47,7 @@ public function testOrderByFields(): void $result = $query->getResult(); - $this->assertEquals(2, sizeof($result)); + $this->assertEquals(2, count($result)); $this->assertArrayHasKey('id', $result[0]); $this->assertArrayHasKey('id', $result[1]); @@ -77,7 +77,7 @@ public function testOrderByAllObjectFields(): void $result = $query->getResult(); - $this->assertEquals(2, sizeof($result)); + $this->assertEquals(2, count($result)); $this->assertTrue($result[0][0] instanceof DDC1430Order); $this->assertTrue($result[1][0] instanceof DDC1430Order); @@ -104,7 +104,7 @@ public function testTicket(): void $result = $query->getResult(); - $this->assertEquals(2, sizeof($result)); + $this->assertEquals(2, count($result)); $this->assertTrue($result[0][0] instanceof DDC1430Order); $this->assertTrue($result[1][0] instanceof DDC1430Order); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index 5771f5f6885..5b5ad626692 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -87,50 +87,57 @@ public function testOriginalEntityDataEmptyWhenProxyLoadedFromTwoAssociations(): class DDC440Phone { /** + * @var int * @Column(name="id", type="integer") * @Id * @GeneratedValue(strategy="AUTO") */ protected $id; + /** + * @var DDC440Client * @ManyToOne(targetEntity="DDC440Client",inversedBy="phones") * @JoinColumns({ * @JoinColumn(name="client_id", referencedColumnName="id") * }) */ protected $client; - /** @Column(name="phonenumber", type="string") */ + + /** + * @var string + * @Column(name="phonenumber", type="string") + */ protected $number; - public function setNumber($value): void + public function setNumber(string $value): void { $this->number = $value; } - public function getNumber() + public function getNumber(): string { return $this->number; } - public function setClient(DDC440Client $value, $update_inverse = true): void + public function setClient(DDC440Client $value, bool $updateInverse = true): void { $this->client = $value; - if ($update_inverse) { + if ($updateInverse) { $value->addPhone($this); } } - public function getClient() + public function getClient(): DDC440Client { return $this->client; } - public function getId() + public function getId(): int { return $this->id; } - public function setId($value): void + public function setId(int $value): void { $this->id = $value; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php index 82a1e7972d4..d6d6f99acd7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC758Test.php @@ -10,7 +10,7 @@ use Doctrine\Tests\OrmFunctionalTestCase; use Doctrine\Tests\VerifyDeprecations; -use function sizeof; +use function count; class DDC758Test extends OrmFunctionalTestCase { @@ -108,13 +108,13 @@ public function testManyToManyMergeAssociationAdds(): void $cmsGroups = $this->_em->getRepository(CmsGroup::class)->findAll(); // Check the entities are in the database - $this->assertEquals(1, sizeof($cmsUsers)); - $this->assertEquals(2, sizeof($cmsGroups)); + $this->assertEquals(1, count($cmsUsers)); + $this->assertEquals(2, count($cmsGroups)); // Check the associations between the entities are now in the database - $this->assertEquals(2, sizeof($cmsUsers[0]->groups)); - $this->assertEquals(1, sizeof($cmsGroups[0]->users)); - $this->assertEquals(1, sizeof($cmsGroups[1]->users)); + $this->assertEquals(2, count($cmsUsers[0]->groups)); + $this->assertEquals(1, count($cmsGroups[0]->users)); + $this->assertEquals(1, count($cmsGroups[1]->users)); $this->assertSame($cmsUsers[0]->groups[0], $cmsGroups[0]); $this->assertSame($cmsUsers[0]->groups[1], $cmsGroups[1]); @@ -184,12 +184,12 @@ public function testManyToManyMergeAssociationRemoves(): void $cmsGroups = $this->_em->getRepository(CmsGroup::class)->findAll(); // Check the entities are in the database - $this->assertEquals(1, sizeof($cmsUsers)); - $this->assertEquals(2, sizeof($cmsGroups)); + $this->assertEquals(1, count($cmsUsers)); + $this->assertEquals(2, count($cmsGroups)); // Check the associations between the entities are now in the database - $this->assertEquals(0, sizeof($cmsUsers[0]->groups)); - $this->assertEquals(0, sizeof($cmsGroups[0]->users)); - $this->assertEquals(0, sizeof($cmsGroups[1]->users)); + $this->assertEquals(0, count($cmsUsers[0]->groups)); + $this->assertEquals(0, count($cmsGroups[0]->users)); + $this->assertEquals(0, count($cmsGroups[1]->users)); } } diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 8dc38590b05..f27b505cee2 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\EventManager; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\ClassMetadata; @@ -474,6 +475,9 @@ public function testAddToIdentityMapValidIdentifiers(object $entity, string $idH self::assertSame($entity, $this->_unitOfWork->getByIdHash($idHash, get_class($entity))); } + /** + * @psalm-return array + */ public function entitiesWithValidIdentifiersProvider() { $emptyString = new EntityWithStringIdentifier(); @@ -520,7 +524,7 @@ public function testRegisteringAManagedInstanceRequiresANonEmptyIdentifier(): vo } /** - * @param array $identifier + * @param array $identifier * * @dataProvider entitiesWithInvalidIdentifiersProvider */ @@ -531,7 +535,10 @@ public function testAddToIdentityMapInvalidIdentifiers(object $entity, array $id $this->_unitOfWork->registerManaged($entity, $identifier, []); } - public function entitiesWithInvalidIdentifiersProvider() + /** + * @psalm-return array}> + */ + public function entitiesWithInvalidIdentifiersProvider(): array { $firstNullString = new EntityWithCompositeStringIdentifier(); @@ -822,22 +829,30 @@ public function testCommitThrowOptimisticLockExceptionWhenConnectionCommitReturn */ class NotifyChangedEntity implements NotifyPropertyChanged { + /** @psalm-var list */ private $_listeners = []; + /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ private $id; + /** * @var string * @Column(type="string") */ private $data; + /** @var mixed */ private $transient; // not persisted - /** @OneToMany(targetEntity="NotifyChangedRelatedItem", mappedBy="owner") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="NotifyChangedRelatedItem", mappedBy="owner") + */ private $items; public function __construct() @@ -845,12 +860,12 @@ public function __construct() $this->items = new ArrayCollection(); } - public function getId() + public function getId(): int { return $this->id; } - public function getItems() + public function getItems(): Collection { return $this->items; } @@ -858,20 +873,26 @@ public function getItems() public function setTransient($value): void { if ($value !== $this->transient) { - $this->_onPropertyChanged('transient', $this->transient, $value); + $this->onPropertyChanged('transient', $this->transient, $value); $this->transient = $value; } } + /** + * @return mixed + */ public function getData() { return $this->data; } + /** + * @param mixed $data + */ public function setData($data): void { if ($data !== $this->data) { - $this->_onPropertyChanged('data', $this->data, $data); + $this->onPropertyChanged('data', $this->data, $data); $this->data = $data; } } @@ -881,7 +902,12 @@ public function addPropertyChangedListener(PropertyChangedListener $listener): v $this->_listeners[] = $listener; } - protected function _onPropertyChanged($propName, $oldValue, $newValue): void + /** + * @param mixed $propName + * @param mixed $oldValue + * @param mixed $newValue + */ + protected function onPropertyChanged($propName, $oldValue, $newValue): void { if ($this->_listeners) { foreach ($this->_listeners as $listener) { @@ -895,26 +921,30 @@ protected function _onPropertyChanged($propName, $oldValue, $newValue): void class NotifyChangedRelatedItem { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ private $id; - /** @ManyToOne(targetEntity="NotifyChangedEntity", inversedBy="items") */ + /** + * @var NotifyChangedEntity|null + * @ManyToOne(targetEntity="NotifyChangedEntity", inversedBy="items") + */ private $owner; - public function getId() + public function getId(): int { return $this->id; } - public function getOwner() + public function getOwner(): ?NotifyChangedEntity { return $this->owner; } - public function setOwner($owner): void + public function setOwner(?NotifyChangedEntity $owner): void { $this->owner = $owner; } @@ -923,9 +953,18 @@ public function setOwner($owner): void /** @Entity */ class VersionedAssignedIdentifierEntity { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ public $id; - /** @Version @Column(type="integer") */ + + /** + * @var int + * @Version + * @Column(type="integer") + */ public $version; } @@ -968,10 +1007,17 @@ class EntityWithCompositeStringIdentifier /** @Entity */ class EntityWithRandomlyGeneratedField { - /** @Id @Column(type="string") */ + /** + * @var string + * @Id + * @Column(type="string") + */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $generatedField; public function __construct() @@ -984,7 +1030,12 @@ public function __construct() /** @Entity */ class CascadePersistedEntity { - /** @Id @Column(type="string") @GeneratedValue(strategy="NONE") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="NONE") + */ private $id; public function __construct() @@ -996,10 +1047,18 @@ public function __construct() /** @Entity */ class EntityWithCascadingAssociation { - /** @Id @Column(type="string") @GeneratedValue(strategy="NONE") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="NONE") + */ private $id; - /** @ManyToOne(targetEntity=CascadePersistedEntity::class, cascade={"persist"}) */ + /** + * @var CascadePersistedEntity + * @ManyToOne(targetEntity=CascadePersistedEntity::class, cascade={"persist"}) + */ public $cascaded; public function __construct() @@ -1011,10 +1070,18 @@ public function __construct() /** @Entity */ class EntityWithNonCascadingAssociation { - /** @Id @Column(type="string") @GeneratedValue(strategy="NONE") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="NONE") + */ private $id; - /** @ManyToOne(targetEntity=CascadePersistedEntity::class) */ + /** + * @var CascadePersistedEntity + * @ManyToOne(targetEntity=CascadePersistedEntity::class) + */ public $nonCascaded; public function __construct() From 58c95a92d1ac1bb2f71d8fde6d01b26e73483e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 9 Feb 2021 09:29:48 +0100 Subject: [PATCH 07/27] Manually fix cs --- tests/Doctrine/Tests/Models/CMS/CmsUser.php | 68 ++++-- .../Doctrine/Tests/ORM/EntityManagerTest.php | 2 +- .../ORM/Functional/EntityRepositoryTest.php | 10 +- .../ORM/Functional/LifecycleCallbackTest.php | 101 +++++--- .../Tests/ORM/Functional/Locking/LockTest.php | 10 +- ...OneToManyUnidirectionalAssociationTest.php | 2 +- .../ORM/Functional/OrderedCollectionTest.php | 4 +- .../Tests/ORM/Functional/QueryCacheTest.php | 13 +- .../Tests/ORM/Functional/QueryTest.php | 4 +- .../ORM/Functional/ReferenceProxyTest.php | 2 +- .../ORM/Functional/Ticket/DDC1666Test.php | 2 +- .../ORM/Functional/Ticket/DDC4003Test.php | 2 +- .../ORM/Functional/Ticket/DDC656Test.php | 2 +- .../ORM/Functional/Ticket/DDC735Test.php | 2 +- .../Tests/ORM/Functional/ValueObjectsTest.php | 219 ++++++++++++++---- .../Tests/ORM/Mapping/ClassMetadataTest.php | 16 +- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 2 +- .../ORM/Tools/Pagination/CountWalkerTest.php | 10 +- .../LimitSubqueryOutputWalkerTest.php | 20 +- .../Pagination/LimitSubqueryWalkerTest.php | 6 +- .../Tools/Pagination/PaginationTestCase.php | 6 +- 21 files changed, 356 insertions(+), 147 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsUser.php b/tests/Doctrine/Tests/Models/CMS/CmsUser.php index e30f320fd85..e2f67b103dd 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsUser.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsUser.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\CMS; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping\ClassMetadataInfo; /** @@ -129,24 +130,51 @@ class CmsUser */ public $id; - /** @Column(type="string", length=50, nullable=true) */ + /** + * @var string + * @Column(type="string", length=50, nullable=true) + */ public $status; - /** @Column(type="string", length=255, unique=true) */ + + /** + * @var string + * @Column(type="string", length=255, unique=true) + */ public $username; - /** @Column(type="string", length=255) */ + + /** + * @psalm-var string|null + * @Column(type="string", length=255) + */ public $name; - /** @OneToMany(targetEntity="CmsPhonenumber", mappedBy="user", cascade={"persist", "merge"}, orphanRemoval=true) */ + + /** + * @psalm-var Collection + * @OneToMany(targetEntity="CmsPhonenumber", mappedBy="user", cascade={"persist", "merge"}, orphanRemoval=true) + */ public $phonenumbers; - /** @OneToMany(targetEntity="CmsArticle", mappedBy="user", cascade={"detach"}) */ + + /** + * @psalm-var Collection + * @OneToMany(targetEntity="CmsArticle", mappedBy="user", cascade={"detach"}) + */ public $articles; - /** @OneToOne(targetEntity="CmsAddress", mappedBy="user", cascade={"persist"}, orphanRemoval=true) */ + + /** + * @var CmsAddress + * @OneToOne(targetEntity="CmsAddress", mappedBy="user", cascade={"persist"}, orphanRemoval=true) + */ public $address; + /** + * @var CmsEmail * @OneToOne(targetEntity="CmsEmail", inversedBy="user", cascade={"persist"}, orphanRemoval=true) * @JoinColumn(referencedColumnName="id", nullable=true) */ public $email; + /** + * @psalm-var Collection * @ManyToMany(targetEntity="CmsGroup", inversedBy="users", cascade={"persist", "merge", "detach"}) * @JoinTable(name="cms_users_groups", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, @@ -154,7 +182,9 @@ class CmsUser * ) */ public $groups; + /** + * @var Collection * @ManyToMany(targetEntity="CmsTag", inversedBy="users", cascade={"all"}) * @JoinTable(name="cms_users_tags", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, @@ -163,8 +193,10 @@ class CmsUser */ public $tags; + /** @var mixed */ public $nonPersistedProperty; + /** @var mixed */ public $nonPersistedPropertyObject; public function __construct() @@ -175,22 +207,22 @@ public function __construct() $this->tags = new ArrayCollection(); } - public function getId() + public function getId(): int { return $this->id; } - public function getStatus() + public function getStatus(): string { return $this->status; } - public function getUsername() + public function getUsername(): string { return $this->username; } - public function getName() + public function getName(): ?string { return $this->name; } @@ -204,7 +236,10 @@ public function addPhonenumber(CmsPhonenumber $phone): void $phone->setUser($this); } - public function getPhonenumbers() + /** + * @psalm-return Collection + */ + public function getPhonenumbers(): Collection { return $this->phonenumbers; } @@ -221,7 +256,10 @@ public function addGroup(CmsGroup $group): void $group->addUser($this); } - public function getGroups() + /** + * @psalm-return Collection + */ + public function getGroups(): Collection { return $this->groups; } @@ -232,12 +270,12 @@ public function addTag(CmsTag $tag): void $tag->addUser($this); } - public function getTags() + public function getTags(): Collection { return $this->tags; } - public function removePhonenumber($index) + public function removePhonenumber($index): bool { if (isset($this->phonenumbers[$index])) { $ph = $this->phonenumbers[$index]; @@ -250,7 +288,7 @@ public function removePhonenumber($index) return false; } - public function getAddress() + public function getAddress(): CmsAddress { return $this->address; } diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index d68136e417d..4c93ec88408 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -125,7 +125,7 @@ public function testCreateQueryBuilderAliasValid(): void $this->assertEquals('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u', $q3->getQuery()->getDql()); } - public function testCreateQuery_DqlIsOptional(): void + public function testCreateQueryDqlIsOptional(): void { $this->assertInstanceOf(Query::class, $this->_em->createQuery()); } diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php index a4565a58a00..650e7aa2bf7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php @@ -331,7 +331,7 @@ public function testExceptionIsThrownWhenUsingInvalidFieldName(): void * @group locking * @group DDC-178 */ - public function testPessimisticReadLockWithoutTransaction_ThrowsException(): void + public function testPessimisticReadLockWithoutTransactionThrowsException(): void { $this->expectException(TransactionRequiredException::class); @@ -343,7 +343,7 @@ public function testPessimisticReadLockWithoutTransaction_ThrowsException(): voi * @group locking * @group DDC-178 */ - public function testPessimisticWriteLockWithoutTransaction_ThrowsException(): void + public function testPessimisticWriteLockWithoutTransactionThrowsException(): void { $this->expectException(TransactionRequiredException::class); @@ -355,7 +355,7 @@ public function testPessimisticWriteLockWithoutTransaction_ThrowsException(): vo * @group locking * @group DDC-178 */ - public function testOptimisticLockUnversionedEntity_ThrowsException(): void + public function testOptimisticLockUnversionedEntityThrowsException(): void { $this->expectException(OptimisticLockException::class); @@ -367,7 +367,7 @@ public function testOptimisticLockUnversionedEntity_ThrowsException(): void * @group locking * @group DDC-178 */ - public function testIdentityMappedOptimisticLockUnversionedEntity_ThrowsException(): void + public function testIdentityMappedOptimisticLockUnversionedEntityThrowsException(): void { $user = new CmsUser(); $user->name = 'Roman'; @@ -412,7 +412,7 @@ public function testInvalidMagicCall(): void /** * @group DDC-817 */ - public function testFindByAssociationKey_ExceptionOnInverseSide(): void + public function testFindByAssociationKeyExceptionOnInverseSide(): void { [$userId, $addressId] = $this->loadAssociatedFixture(); $repos = $this->_em->getRepository(CmsUser::class); diff --git a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php index 3450e89adcf..b82b2e19a48 100644 --- a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; use Doctrine\ORM\Event\PreUpdateEventArgs; @@ -304,13 +305,13 @@ public function testPostLoadIsInvokedOnFetchJoinedEntities(): void $entA = new LifecycleCallbackCascader(); $this->_em->persist($entA); - $entB_1 = new LifecycleCallbackTestEntity(); - $entB_2 = new LifecycleCallbackTestEntity(); + $entB1 = new LifecycleCallbackTestEntity(); + $entB2 = new LifecycleCallbackTestEntity(); - $entA->entities[] = $entB_1; - $entA->entities[] = $entB_2; - $entB_1->cascader = $entA; - $entB_2->cascader = $entA; + $entA->entities[] = $entB1; + $entA->entities[] = $entB2; + $entB1->cascader = $entA; + $entB2->cascader = $entA; $this->_em->flush(); $this->_em->clear(); @@ -343,7 +344,7 @@ public function testLifecycleCallbacksGetInherited(): void $this->assertEquals(['prePersist' => [0 => 'doStuff']], $childMeta->lifecycleCallbacks); } - public function testLifecycleListener_ChangeUpdateChangeSet(): void + public function testLifecycleListenerChangeUpdateChangeSet(): void { $listener = new LifecycleListenerPreUpdate(); $this->_em->getEventManager()->addEventListener(['preUpdate'], $listener); @@ -412,40 +413,47 @@ public function testLifecycleCallbackEventArgs(): void /** @Entity @HasLifecycleCallbacks */ class LifecycleCallbackTestUser { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; + /** * @var string * @Column(type="string") */ private $value; + /** * @var string * @Column(type="string") */ private $name; - public function getId() + public function getId(): int { return $this->id; } - public function getValue() + public function getValue(): string { return $this->value; } - public function setValue($value): void + public function setValue(string $value): void { $this->value = $value; } - public function getName() + public function getName(): string { return $this->name; } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } @@ -465,32 +473,49 @@ public function testCallback(): void class LifecycleCallbackTestEntity { /* test stuff */ - public $prePersistCallbackInvoked = false; + + /** @var bool */ + public $prePersistCallbackInvoked = false; + + /** @var bool */ public $postPersistCallbackInvoked = false; - public $postLoadCallbackInvoked = false; - public $postLoadCascaderNotNull = false; - public $preFlushCallbackInvoked = false; + + /** @var bool */ + public $postLoadCallbackInvoked = false; + + /** @var bool */ + public $postLoadCascaderNotNull = false; + + /** @var bool */ + public $preFlushCallbackInvoked = false; /** - * @Id @Column(type="integer") + * @var int + * @Id + * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ private $id; - /** @Column(type="string", nullable=true) */ + + /** + * @var string + * @Column(type="string", nullable=true) + */ public $value; /** + * @var LifecycleCallbackCascader * @ManyToOne(targetEntity="LifecycleCallbackCascader") * @JoinColumn(name="cascader_id", referencedColumnName="id") */ public $cascader; - public function getId() + public function getId(): int { return $this->id; } - public function getValue() + public function getValue(): string { return $this->value; } @@ -534,16 +559,24 @@ public function doStuffOnPreFlush(): void class LifecycleCallbackCascader { /* test stuff */ + /** @var bool */ public $postLoadCallbackInvoked = false; - public $postLoadEntitiesCount = 0; + + /** @var int */ + public $postLoadEntitiesCount = 0; /** - * @Id @Column(type="integer") + * @var int + * @Id + * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ private $id; - /** @OneToMany(targetEntity="LifecycleCallbackTestEntity", mappedBy="cascader", cascade={"persist"}) */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="LifecycleCallbackTestEntity", mappedBy="cascader", cascade={"persist"}) + */ public $entities; public function __construct() @@ -558,7 +591,7 @@ public function doStuffOnPostLoad(): void $this->postLoadEntitiesCount = count($this->entities); } - public function getId() + public function getId(): int { return $this->id; } @@ -576,7 +609,12 @@ public function doStuff(): void /** @Entity @Table(name="lc_cb_childentity") */ class LifecycleCallbackChildEntity extends LifecycleCallbackParentEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; } @@ -591,12 +629,19 @@ public function preUpdate(PreUpdateEventArgs $eventArgs): void /** @Entity @HasLifecycleCallbacks */ class LifecycleCallbackEventArgEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id @Column(type="integer") @GeneratedValue + */ public $id; - /** @Column() */ + /** + * @var string + * @Column() + */ public $value; + /** @var array */ public $calls = []; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php index a8ea0237cec..1b56794a842 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php @@ -51,7 +51,7 @@ public function testLockVersionedEntity(): void * @group DDC-178 * @group locking */ - public function testLockVersionedEntity_MismatchThrowsException(): void + public function testLockVersionedEntityMismatchThrowsException(): void { $article = new CmsArticle(); $article->text = 'my article'; @@ -69,7 +69,7 @@ public function testLockVersionedEntity_MismatchThrowsException(): void * @group DDC-178 * @group locking */ - public function testLockUnversionedEntity_ThrowsException(): void + public function testLockUnversionedEntityThrowsException(): void { $user = new CmsUser(); $user->name = 'foo'; @@ -88,7 +88,7 @@ public function testLockUnversionedEntity_ThrowsException(): void * @group DDC-178 * @group locking */ - public function testLockUnmanagedEntity_ThrowsException(): void + public function testLockUnmanagedEntityThrowsException(): void { $article = new CmsArticle(); @@ -102,7 +102,7 @@ public function testLockUnmanagedEntity_ThrowsException(): void * @group DDC-178 * @group locking */ - public function testLockPessimisticRead_NoTransaction_ThrowsException(): void + public function testLockPessimisticReadNoTransactionThrowsException(): void { $article = new CmsArticle(); $article->text = 'my article'; @@ -120,7 +120,7 @@ public function testLockPessimisticRead_NoTransaction_ThrowsException(): void * @group DDC-178 * @group locking */ - public function testLockPessimisticWrite_NoTransaction_ThrowsException(): void + public function testLockPessimisticWriteNoTransactionThrowsException(): void { $article = new CmsArticle(); $article->text = 'my article'; diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php index cc5859f1fe1..6375fb4160f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToManyUnidirectionalAssociationTest.php @@ -37,7 +37,7 @@ protected function setUp(): void $this->_em->flush(); } - public function testPersistOwning_InverseCascade(): void + public function testPersistOwningInverseCascade(): void { $leg = new RoutingLeg(); $leg->fromLocation = $this->locations['Berlin']; diff --git a/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php index 83a74a60a0f..12ee5a4a521 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OrderedCollectionTest.php @@ -61,7 +61,7 @@ public function createPersistedRouteWithLegs() return $routeId; } - public function testLazyManyToManyCollection_IsRetrievedWithOrderByClause(): void + public function testLazyManyToManyCollectionIsRetrievedWithOrderByClause(): void { $routeId = $this->createPersistedRouteWithLegs(); @@ -72,7 +72,7 @@ public function testLazyManyToManyCollection_IsRetrievedWithOrderByClause(): voi $this->assertEquals('Bonn', $route->legs[1]->fromLocation->getName()); } - public function testLazyOneToManyCollection_IsRetrievedWithOrderByClause(): void + public function testLazyOneToManyCollectionIsRetrievedWithOrderByClause(): void { $route = new RoutingRoute(); diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php index fb4b330c857..1fa4434906c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php @@ -7,6 +7,7 @@ use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\CacheProvider; +use Doctrine\ORM\Query; use Doctrine\ORM\Query\Exec\AbstractSqlExecutor; use Doctrine\ORM\Query\ParserResult; use Doctrine\Tests\OrmFunctionalTestCase; @@ -37,7 +38,7 @@ private function getCacheSize(ArrayCache $cache): int return count($this->cacheDataReflection->getValue($cache)); } - public function testQueryCache_DependsOnHints() + public function testQueryCacheDependsOnHints(): Query { $query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux'); @@ -60,7 +61,7 @@ public function testQueryCache_DependsOnHints() * * @depends testQueryCache_DependsOnHints */ - public function testQueryCache_DependsOnFirstResult($query): void + public function testQueryCacheDependsOnFirstResult($query): void { $cache = $query->getQueryCacheDriver(); $cacheCount = $this->getCacheSize($cache); @@ -77,7 +78,7 @@ public function testQueryCache_DependsOnFirstResult($query): void * * @depends testQueryCache_DependsOnHints */ - public function testQueryCache_DependsOnMaxResults($query): void + public function testQueryCacheDependsOnMaxResults($query): void { $cache = $query->getQueryCacheDriver(); $cacheCount = $this->getCacheSize($cache); @@ -93,7 +94,7 @@ public function testQueryCache_DependsOnMaxResults($query): void * * @depends testQueryCache_DependsOnHints */ - public function testQueryCache_DependsOnHydrationMode($query): void + public function testQueryCacheDependsOnHydrationMode($query): void { $cache = $query->getQueryCacheDriver(); $cacheCount = $this->getCacheSize($cache); @@ -102,7 +103,7 @@ public function testQueryCache_DependsOnHydrationMode($query): void $this->assertEquals($cacheCount + 1, $this->getCacheSize($cache)); } - public function testQueryCache_NoHitSaveParserResult(): void + public function testQueryCacheNoHitSaveParserResult(): void { $this->_em->getConfiguration()->setQueryCacheImpl(new ArrayCache()); @@ -120,7 +121,7 @@ public function testQueryCache_NoHitSaveParserResult(): void $query->getResult(); } - public function testQueryCache_HitDoesNotSaveParserResult(): void + public function testQueryCacheHitDoesNotSaveParserResult(): void { $this->_em->getConfiguration()->setQueryCacheImpl(new ArrayCache()); diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index fb4c92c203f..1355982f6d9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -246,7 +246,7 @@ public function testIterateResultAsArrayAndParams(): void self::assertEquals([$expectedArticle], $articles); } - public function testIterateResult_IterativelyBuildUpUnitOfWork(): void + public function testIterateResultIterativelyBuildUpUnitOfWork(): void { $article1 = new CmsArticle(); $article1->topic = 'Doctrine 2'; @@ -351,7 +351,7 @@ public function testIterateResultClearEveryCycle(): void $this->_em->flush(); } - public function testIterateResult_FetchJoinedCollection_ThrowsException(): void + public function testIterateResultFetchJoinedCollectionThrowsException(): void { $this->expectException(QueryException::class); $query = $this->_em->createQuery("SELECT u, a FROM ' . CmsUser::class . ' u JOIN u.articles a"); diff --git a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php index dd3f196c151..d1bd391b475 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php @@ -188,7 +188,7 @@ public function testDoNotInitializeProxyOnGettingTheIdentifier(): void /** * @group DDC-1625 */ - public function testDoNotInitializeProxyOnGettingTheIdentifier_DDC_1625(): void + public function testDoNotInitializeProxyOnGettingTheIdentifierDDC1625(): void { $id = $this->createAuction(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1666Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1666Test.php index 111a9e03d3f..aba16f27ca4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1666Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1666Test.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testGivenOrphanRemovalOneToOne_WhenReplacing_ThenNoUniqueConstraintError(): void + public function testGivenOrphanRemovalOneToOneWhenReplacingThenNoUniqueConstraintError(): void { $user = new CmsUser(); $user->name = 'Benjamin'; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC4003Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC4003Test.php index 914aaa7fc15..3adc65619d4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC4003Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC4003Test.php @@ -12,7 +12,7 @@ class DDC4003Test extends SecondLevelCacheAbstractTest { - public function test_reads_through_repository_same_data_that_it_wrote_in_cache(): void + public function testReadsThroughRepositorySameDataThatItWroteInCache(): void { $this->loadFixturesCountries(); $this->loadFixturesStates(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php index bded1a37c43..104914d3e14 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php @@ -25,7 +25,7 @@ protected function setUp(): void } } - public function testRecomputeSingleEntityChangeSet_PreservesFieldOrder(): void + public function testRecomputeSingleEntityChangeSetPreservesFieldOrder(): void { $entity = new DDC656Entity(); $entity->setName('test1'); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php index cdef46214de..97465e49651 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php @@ -26,7 +26,7 @@ protected function setUp(): void } } - public function testRemoveElement_AppliesOrphanRemoval(): void + public function testRemoveElementAppliesOrphanRemoval(): void { // Create a product and its first review $product = new DDC735Product(); diff --git a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php index 38f77e62e5b..2ea08862274 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php @@ -324,8 +324,10 @@ public function testInlineEmbeddableInMappedSuperClass(): void /** * @dataProvider getInfiniteEmbeddableNestingData */ - public function testThrowsExceptionOnInfiniteEmbeddableNesting($embeddableClassName, $declaredEmbeddableClassName): void - { + public function testThrowsExceptionOnInfiniteEmbeddableNesting( + string $embeddableClassName, + string $declaredEmbeddableClassName + ): void { $this->expectException(MappingException::class); $this->expectExceptionMessage( sprintf( @@ -342,7 +344,10 @@ public function testThrowsExceptionOnInfiniteEmbeddableNesting($embeddableClassN ); } - public function getInfiniteEmbeddableNestingData() + /** + * @psalm-return list + */ + public function getInfiniteEmbeddableNestingData(): array { return [ ['DDCInfiniteNestingEmbeddable', 'DDCInfiniteNestingEmbeddable'], @@ -357,22 +362,33 @@ public function getInfiniteEmbeddableNestingData() */ class DDC93Person { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** - * @var string + * @var string|null * @Column(type="string") */ public $name; - /** @Embedded(class="DDC93Address") */ + /** + * @var DDC93Address|null + * @Embedded(class="DDC93Address") + */ public $address; - /** @Embedded(class = "DDC93Timestamps") */ + /** + * @var DDC93Timestamps + * @Embedded(class = "DDC93Timestamps") + */ public $timestamps; - public function __construct($name = null, ?DDC93Address $address = null) + public function __construct(?string $name = null, ?DDC93Address $address = null) { $this->name = $name; $this->address = $address; @@ -385,7 +401,10 @@ public function __construct($name = null, ?DDC93Address $address = null) */ class DDC93Timestamps { - /** @Column(type = "datetime") */ + /** + * @var DateTime + * @Column(type = "datetime") + */ public $createdAt; public function __construct(DateTime $createdAt) @@ -404,10 +423,17 @@ public function __construct(DateTime $createdAt) */ abstract class DDC93Vehicle { - /** @Id @GeneratedValue(strategy = "AUTO") @Column(type = "integer") */ + /** + * @var int + * @Id + * @GeneratedValue(strategy = "AUTO") @Column(type = "integer") + */ public $id; - /** @Embedded(class = "DDC93Address") */ + /** + * @var DDC93Address + * @Embedded(class = "DDC93Address") + */ public $address; public function __construct(DDC93Address $address) @@ -428,10 +454,13 @@ class DDC93Car extends DDC93Vehicle */ class DDC93Country { - /** @Column(type="string", nullable=true) */ + /** + * @var string|null + * @Column(type="string", nullable=true) + */ public $name; - public function __construct($name = null) + public function __construct(?string $name = null) { $this->name = $name; } @@ -443,25 +472,35 @@ public function __construct($name = null) class DDC93Address { /** - * @var string + * @var string|null * @Column(type="string") */ public $street; + /** - * @var string + * @var string|null * @Column(type="string") */ public $zip; + /** - * @var string + * @var string|null * @Column(type="string") */ public $city; - /** @Embedded(class = "DDC93Country") */ + + /** + * @var DDC93Country|null + * @Embedded(class = "DDC93Country") + */ public $country; - public function __construct($street = null, $zip = null, $city = null, ?DDC93Country $country = null) - { + public function __construct( + ?string $street = null, + ?string $zip = null, + ?string $city = null, + ?DDC93Country $country = null + ) { $this->street = $street; $this->zip = $zip; $this->city = $city; @@ -472,10 +511,17 @@ public function __construct($street = null, $zip = null, $city = null, ?DDC93Cou /** @Entity */ class DDC93Customer { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue @Column(type="integer") + */ private $id; - /** @Embedded(class = "DDC93ContactInfo", columnPrefix = "contact_info_") */ + /** + * @var DDC93ContactInfo + * @Embedded(class = "DDC93ContactInfo", columnPrefix = "contact_info_") + */ private $contactInfo; } @@ -487,7 +533,11 @@ class DDC93ContactInfo * @Column(type="string") */ public $email; - /** @Embedded(class = "DDC93Address") */ + + /** + * @var DDC93Address + * @Embedded(class = "DDC93Address") + */ public $address; } @@ -496,10 +546,16 @@ class DDC93ContactInfo */ class DDC3028PersonWithPrefix { - /** @Embedded(class="DDC3028Id", columnPrefix = "foobar_") */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = "foobar_") + */ public $id; - /** @Embedded(class="DDC3028NestedEmbeddable", columnPrefix = "bloo_") */ + /** + * @var DDC3028NestedEmbeddable|null + * @Embedded(class="DDC3028NestedEmbeddable", columnPrefix = "bloo_") + */ public $nested; public function __construct(?DDC3028Id $id = null, ?DDC3028NestedEmbeddable $nested = null) @@ -514,10 +570,16 @@ public function __construct(?DDC3028Id $id = null, ?DDC3028NestedEmbeddable $nes */ class DDC3028PersonEmptyPrefix { - /** @Embedded(class="DDC3028Id", columnPrefix = "") */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = "") + */ public $id; - /** @Embedded(class="DDC3028NestedEmbeddable", columnPrefix = "") */ + /** + * @var DDC3028NestedEmbeddable|null + * @Embedded(class="DDC3028NestedEmbeddable", columnPrefix = "") + */ public $nested; public function __construct(?DDC3028Id $id = null, ?DDC3028NestedEmbeddable $nested = null) @@ -532,7 +594,10 @@ public function __construct(?DDC3028Id $id = null, ?DDC3028NestedEmbeddable $nes */ class DDC3028PersonPrefixFalse { - /** @Embedded(class="DDC3028Id", columnPrefix = false) */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = false) + */ public $id; public function __construct(?DDC3028Id $id = null) @@ -546,10 +611,14 @@ public function __construct(?DDC3028Id $id = null) */ class DDC3028Id { - /** @Id @Column(type="string") */ + /** + * @var string|null + * @Id + * @Column(type="string") + */ public $id; - public function __construct($id = null) + public function __construct(?string $id = null) { $this->id = $id; } @@ -560,13 +629,22 @@ public function __construct($id = null) */ class DDC3028NestedEmbeddable { - /** @Embedded(class="DDC3028Id", columnPrefix = "foo_") */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = "foo_") + */ public $nestedWithPrefix; - /** @Embedded(class="DDC3028Id", columnPrefix = "") */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = "") + */ public $nestedWithEmptyPrefix; - /** @Embedded(class="DDC3028Id", columnPrefix = false) */ + /** + * @var DDC3028Id|null + * @Embedded(class="DDC3028Id", columnPrefix = false) + */ public $nestedWithPrefixFalse; public function __construct( @@ -585,10 +663,18 @@ public function __construct( */ abstract class DDC3027Animal { - /** @Id @GeneratedValue(strategy = "AUTO") @Column(type = "integer") */ + /** + * @var int + * @Id + * @GeneratedValue(strategy = "AUTO") + * @Column(type = "integer") + */ public $id; - /** @Embedded(class = "DDC93Address") */ + /** + * @var DDC93Address + * @Embedded(class = "DDC93Address") + */ public $address; } @@ -604,7 +690,10 @@ class DDC3027Dog extends DDC3027Animal */ class DDCInfiniteNestingEmbeddable { - /** @Embedded(class="DDCInfiniteNestingEmbeddable") */ + /** + * @var DDCInfiniteNestingEmbeddable + * @Embedded(class="DDCInfiniteNestingEmbeddable") + */ public $nested; } @@ -613,13 +702,22 @@ class DDCInfiniteNestingEmbeddable */ class DDCNestingEmbeddable1 { - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id1; - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id2; - /** @Embedded(class="DDCNestingEmbeddable2") */ + /** + * @var DDCNestingEmbeddable2 + * @Embedded(class="DDCNestingEmbeddable2") + */ public $nested; } @@ -628,13 +726,22 @@ class DDCNestingEmbeddable1 */ class DDCNestingEmbeddable2 { - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id1; - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id2; - /** @Embedded(class="DDCNestingEmbeddable3") */ + /** + * @var DDCNestingEmbeddable3 + * @Embedded(class="DDCNestingEmbeddable3") + */ public $nested; } @@ -643,13 +750,22 @@ class DDCNestingEmbeddable2 */ class DDCNestingEmbeddable3 { - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id1; - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id2; - /** @Embedded(class="DDCNestingEmbeddable4") */ + /** + * @var DDCNestingEmbeddable4 + * @Embedded(class="DDCNestingEmbeddable4") + */ public $nested; } @@ -658,12 +774,21 @@ class DDCNestingEmbeddable3 */ class DDCNestingEmbeddable4 { - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id1; - /** @Embedded(class="DDC3028Id") */ + /** + * @var DDC3028Id + * @Embedded(class="DDC3028Id") + */ public $id2; - /** @Embedded(class="DDCNestingEmbeddable1") */ + /** + * @var DDCNestingEmbeddable1 + * @Embedded(class="DDCNestingEmbeddable1") + */ public $nested; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 75ad5e28432..b972d6bb443 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -203,7 +203,7 @@ public function testSetSubClassesInGlobalNamespace(): void /** * @group DDC-268 */ - public function testSetInvalidVersionMapping_ThrowsException(): void + public function testSetInvalidVersionMappingThrowsException(): void { $field = []; $field['fieldName'] = 'foo'; @@ -216,7 +216,7 @@ public function testSetInvalidVersionMapping_ThrowsException(): void $cm->setVersionMapping($field); } - public function testGetSingleIdentifierFieldName_MultipleIdentifierEntity_ThrowsException(): void + public function testGetSingleIdentifierFieldNameMultipleIdentifierEntityThrowsException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -226,7 +226,7 @@ public function testGetSingleIdentifierFieldName_MultipleIdentifierEntity_Throws $cm->getSingleIdentifierFieldName(); } - public function testGetSingleIdentifierFieldName_NoIdEntity_ThrowsException(): void + public function testGetSingleIdentifierFieldNameNoIdEntityThrowsException(): void { $cm = new ClassMetadata(DDC6412File::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -248,7 +248,7 @@ public function testDuplicateAssociationMappingException(): void $cm->addInheritedAssociationMapping($a2); } - public function testDuplicateColumnName_ThrowsMappingException(): void + public function testDuplicateColumnNameThrowsMappingException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -259,7 +259,7 @@ public function testDuplicateColumnName_ThrowsMappingException(): void $cm->mapField(['fieldName' => 'username', 'columnName' => 'name']); } - public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingException(): void + public function testDuplicateColumnNameDiscriminatorColumnThrowsMappingException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -270,7 +270,7 @@ public function testDuplicateColumnName_DiscriminatorColumn_ThrowsMappingExcepti $cm->setDiscriminatorColumn(['name' => 'name']); } - public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingException(): void + public function testDuplicateColumnNameDiscriminatorColumn2ThrowsMappingException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -281,7 +281,7 @@ public function testDuplicateColumnName_DiscriminatorColumn2_ThrowsMappingExcept $cm->mapField(['fieldName' => 'name', 'columnName' => 'name']); } - public function testDuplicateFieldAndAssociationMapping1_ThrowsException(): void + public function testDuplicateFieldAndAssociationMapping1ThrowsException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); @@ -292,7 +292,7 @@ public function testDuplicateFieldAndAssociationMapping1_ThrowsException(): void $cm->mapOneToOne(['fieldName' => 'name', 'targetEntity' => 'CmsUser']); } - public function testDuplicateFieldAndAssociationMapping2_ThrowsException(): void + public function testDuplicateFieldAndAssociationMapping2ThrowsException(): void { $cm = new ClassMetadata(CMS\CmsUser::class); $cm->initializeReflection(new RuntimeReflectionService()); diff --git a/tests/Doctrine/Tests/ORM/Query/QueryTest.php b/tests/Doctrine/Tests/ORM/Query/QueryTest.php index 1afa1abe3c7..5d06e6e0b58 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryTest.php @@ -47,7 +47,7 @@ public function testGetParameters(): void $this->assertEquals($parameters, $query->getParameters()); } - public function testGetParameters_HasSomeAlready(): void + public function testGetParametersHasSomeAlready(): void { $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); $query->setParameter(2, 84); diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php index fa2988a366d..466ccafd05b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/CountWalkerTest.php @@ -28,7 +28,7 @@ public function testCountQuery(): void ); } - public function testCountQuery_MixedResultsWithName(): void + public function testCountQueryMixedResultsWithName(): void { $query = $this->entityManager->createQuery( 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a' @@ -43,7 +43,7 @@ public function testCountQuery_MixedResultsWithName(): void ); } - public function testCountQuery_KeepsGroupBy(): void + public function testCountQueryKeepsGroupBy(): void { $query = $this->entityManager->createQuery( 'SELECT b FROM Doctrine\Tests\ORM\Tools\Pagination\BlogPost b GROUP BY b.id' @@ -58,7 +58,7 @@ public function testCountQuery_KeepsGroupBy(): void ); } - public function testCountQuery_RemovesOrderBy(): void + public function testCountQueryRemovesOrderBy(): void { $query = $this->entityManager->createQuery( 'SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\BlogPost p JOIN p.category c JOIN p.author a ORDER BY a.name' @@ -73,7 +73,7 @@ public function testCountQuery_RemovesOrderBy(): void ); } - public function testCountQuery_RemovesLimits(): void + public function testCountQueryRemovesLimits(): void { $query = $this->entityManager->createQuery( 'SELECT p, c, a FROM Doctrine\Tests\ORM\Tools\Pagination\BlogPost p JOIN p.category c JOIN p.author a' @@ -88,7 +88,7 @@ public function testCountQuery_RemovesLimits(): void ); } - public function testCountQuery_HavingException(): void + public function testCountQueryHavingException(): void { $query = $this->entityManager->createQuery( 'SELECT g, COUNT(u.id) AS userCount FROM Doctrine\Tests\Models\CMS\CmsGroup g LEFT JOIN g.users u GROUP BY g.id HAVING userCount > 0' diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php index 31e906dde78..061d6c99f2d 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryOutputWalkerTest.php @@ -228,14 +228,14 @@ public function testCountQueryWithArithmeticOrderByCondition(): void public function testCountQueryWithComplexScalarOrderByItem(): void { $query = $this->entityManager->createQuery( - 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.image_height * a.image_width DESC' + 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.imageHeight * a.imageWidth DESC' ); $this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform()); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class); $this->assertSame( - 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, image_height_2 * image_width_3 FROM (SELECT a0_.id AS id_0, a0_.image AS image_1, a0_.image_height AS image_height_2, a0_.image_width AS image_width_3, a0_.image_alt_desc AS image_alt_desc_4, a0_.user_id AS user_id_5 FROM Avatar a0_) dctrn_result_inner ORDER BY image_height_2 * image_width_3 DESC) dctrn_result', + 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, imageHeight_2 * imageWidth_3 FROM (SELECT a0_.id AS id_0, a0_.image AS image_1, a0_.imageHeight AS imageHeight_2, a0_.imageWidth AS imageWidth_3, a0_.imageAltDesc AS imageAltDesc_4, a0_.user_id AS user_id_5 FROM Avatar a0_) dctrn_result_inner ORDER BY imageHeight_2 * imageWidth_3 DESC) dctrn_result', $query->getSQL() ); } @@ -243,14 +243,14 @@ public function testCountQueryWithComplexScalarOrderByItem(): void public function testCountQueryWithComplexScalarOrderByItemJoined(): void { $query = $this->entityManager->createQuery( - 'SELECT u FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.avatar a ORDER BY a.image_height * a.image_width DESC' + 'SELECT u FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.avatar a ORDER BY a.imageHeight * a.imageWidth DESC' ); $this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform()); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class); $this->assertSame( - 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, image_height_1 * image_width_2 FROM (SELECT u0_.id AS id_0, a1_.image_height AS image_height_1, a1_.image_width AS image_width_2, a1_.user_id AS user_id_3 FROM User u0_ INNER JOIN Avatar a1_ ON u0_.id = a1_.user_id) dctrn_result_inner ORDER BY image_height_1 * image_width_2 DESC) dctrn_result', + 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, imageHeight_1 * imageWidth_2 FROM (SELECT u0_.id AS id_0, a1_.imageHeight AS imageHeight_1, a1_.imageWidth AS imageWidth_2, a1_.user_id AS user_id_3 FROM User u0_ INNER JOIN Avatar a1_ ON u0_.id = a1_.user_id) dctrn_result_inner ORDER BY imageHeight_1 * imageWidth_2 DESC) dctrn_result', $query->getSQL() ); } @@ -258,14 +258,14 @@ public function testCountQueryWithComplexScalarOrderByItemJoined(): void public function testCountQueryWithComplexScalarOrderByItemJoinedWithPartial(): void { $query = $this->entityManager->createQuery( - 'SELECT u, partial a.{id, image_alt_desc} FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.avatar a ORDER BY a.image_height * a.image_width DESC' + 'SELECT u, partial a.{id, imageAltDesc} FROM Doctrine\Tests\ORM\Tools\Pagination\User u JOIN u.avatar a ORDER BY a.imageHeight * a.imageWidth DESC' ); $this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform()); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class); $this->assertSame( - 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, image_height_3 * image_width_4 FROM (SELECT u0_.id AS id_0, a1_.id AS id_1, a1_.image_alt_desc AS image_alt_desc_2, a1_.image_height AS image_height_3, a1_.image_width AS image_width_4, a1_.user_id AS user_id_5 FROM User u0_ INNER JOIN Avatar a1_ ON u0_.id = a1_.user_id) dctrn_result_inner ORDER BY image_height_3 * image_width_4 DESC) dctrn_result', + 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, imageHeight_3 * imageWidth_4 FROM (SELECT u0_.id AS id_0, a1_.id AS id_1, a1_.imageAltDesc AS imageAltDesc_2, a1_.imageHeight AS imageHeight_3, a1_.imageWidth AS imageWidth_4, a1_.user_id AS user_id_5 FROM User u0_ INNER JOIN Avatar a1_ ON u0_.id = a1_.user_id) dctrn_result_inner ORDER BY imageHeight_3 * imageWidth_4 DESC) dctrn_result', $query->getSQL() ); } @@ -273,14 +273,14 @@ public function testCountQueryWithComplexScalarOrderByItemJoinedWithPartial(): v public function testCountQueryWithComplexScalarOrderByItemOracle(): void { $query = $this->entityManager->createQuery( - 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.image_height * a.image_width DESC' + 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.imageHeight * a.imageWidth DESC' ); $this->entityManager->getConnection()->setDatabasePlatform(new OraclePlatform()); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class); $this->assertSame( - 'SELECT DISTINCT ID_0, MIN(SCLR_5) AS dctrn_minrownum FROM (SELECT a0_.id AS ID_0, a0_.image AS IMAGE_1, a0_.image_height AS IMAGE_HEIGHT_2, a0_.image_width AS IMAGE_WIDTH_3, a0_.image_alt_desc AS IMAGE_ALT_DESC_4, ROW_NUMBER() OVER(ORDER BY a0_.image_height * a0_.image_width DESC) AS SCLR_5, a0_.user_id AS USER_ID_6 FROM Avatar a0_) dctrn_result GROUP BY ID_0 ORDER BY dctrn_minrownum ASC', + 'SELECT DISTINCT ID_0, MIN(SCLR_5) AS dctrn_minrownum FROM (SELECT a0_.id AS ID_0, a0_.image AS IMAGE_1, a0_.imageHeight AS IMAGEHEIGHT_2, a0_.imageWidth AS IMAGEWIDTH_3, a0_.imageAltDesc AS IMAGEALTDESC_4, ROW_NUMBER() OVER(ORDER BY a0_.imageHeight * a0_.imageWidth DESC) AS SCLR_5, a0_.user_id AS USER_ID_6 FROM Avatar a0_) dctrn_result GROUP BY ID_0 ORDER BY dctrn_minrownum ASC', $query->getSQL() ); } @@ -305,14 +305,14 @@ public function testLimitSubqueryWithHiddenSelectionInOrderBy(): void public function testLimitSubqueryWithColumnWithSortDirectionInName(): void { $query = $this->entityManager->createQuery( - 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.image_alt_desc DESC' + 'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.imageAltDesc DESC' ); $this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform()); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, LimitSubqueryOutputWalker::class); $this->assertSame( - 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, image_alt_desc_4 FROM (SELECT a0_.id AS id_0, a0_.image AS image_1, a0_.image_height AS image_height_2, a0_.image_width AS image_width_3, a0_.image_alt_desc AS image_alt_desc_4, a0_.user_id AS user_id_5 FROM Avatar a0_) dctrn_result_inner ORDER BY image_alt_desc_4 DESC) dctrn_result', + 'SELECT DISTINCT id_0 FROM (SELECT DISTINCT id_0, imageAltDesc_4 FROM (SELECT a0_.id AS id_0, a0_.image AS image_1, a0_.imageHeight AS imageHeight_2, a0_.imageWidth AS imageWidth_3, a0_.imageAltDesc AS imageAltDesc_4, a0_.user_id AS user_id_5 FROM Avatar a0_) dctrn_result_inner ORDER BY imageAltDesc_4 DESC) dctrn_result', $query->getSQL() ); } diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php index e18432cc988..e8c1e91b3e0 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/LimitSubqueryWalkerTest.php @@ -54,7 +54,7 @@ public function testLimitSubqueryWithSortFunction(): void ); } - public function testCountQuery_MixedResultsWithName(): void + public function testCountQueryMixedResultsWithName(): void { $dql = 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a'; $query = $this->entityManager->createQuery($dql); @@ -68,7 +68,7 @@ public function testCountQuery_MixedResultsWithName(): void ); } - public function testAggQuery_MixedResultsWithNameAndSort(): void + public function testAggQueryMixedResultsWithNameAndSort(): void { $dql = 'SELECT a, sum(a.name) as foo FROM Doctrine\Tests\ORM\Tools\Pagination\Author a ORDER BY foo DESC'; $query = $this->entityManager->createQuery($dql); @@ -82,7 +82,7 @@ public function testAggQuery_MixedResultsWithNameAndSort(): void ); } - public function testAggQuery_MultipleMixedResultsWithSort(): void + public function testAggQueryMultipleMixedResultsWithSort(): void { $dql = 'SELECT a, sum(a.name) as foo, (SELECT count(subA.id) FROM Doctrine\Tests\ORM\Tools\Pagination\Author subA WHERE subA.id = a.id ) as bar FROM Doctrine\Tests\ORM\Tools\Pagination\Author a ORDER BY foo DESC, bar ASC'; $query = $this->entityManager->createQuery($dql); diff --git a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php index 2a2800e4a46..de38c9f41d8 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Tools/Pagination/PaginationTestCase.php @@ -243,19 +243,19 @@ class Avatar * @var int * @Column(type="integer") */ - public $image_height; + public $imageHeight; /** * @var int * @Column(type="integer") */ - public $image_width; + public $imageWidth; /** * @var string * @Column(type="string", length=255) */ - public $image_alt_desc; + public $imageAltDesc; } /** @MappedSuperclass */ From 41729be80a2c847871a706b932279ca7356314e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 11 Feb 2021 18:24:40 +0100 Subject: [PATCH 08/27] Spell "first" properly --- tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index 15184770f2e..42f11891140 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -356,7 +356,7 @@ class FirstEntity /** * @var SecondEntity * @OneToOne(targetEntity="SecondEntity") - * @JoinColumn(name="id", referencedColumnName="fist_entity_id") + * @JoinColumn(name="id", referencedColumnName="first_entity_id") */ public $secondEntity; @@ -376,9 +376,9 @@ class SecondEntity /** * @var int * @Id - * @Column(name="fist_entity_id") + * @Column(name="first_entity_id") */ - public $fist_entity_id; + public $first_entity_id; /** * @var string From 61d0f96c173edf794f6929ae639c99ffc65facf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 10 Feb 2021 09:10:55 +0100 Subject: [PATCH 09/27] Manually fix cs --- .../Tests/Models/Legacy/LegacyArticle.php | 25 ++- .../Tests/Models/Legacy/LegacyUser.php | 2 +- .../Doctrine/Tests/ORM/EntityManagerTest.php | 104 ++++----- .../ORM/Functional/Ticket/DDC1301Test.php | 12 +- .../ORM/Hydration/ResultSetMappingTest.php | 12 +- .../Tests/ORM/Id/AssignedGeneratorTest.php | 17 +- .../Tests/ORM/Query/CustomTreeWalkersTest.php | 8 +- .../ORM/Query/DeleteSqlGenerationTest.php | 10 +- tests/Doctrine/Tests/ORM/Query/ExprTest.php | 154 +++++++------- .../Tests/ORM/Query/FilterCollectionTest.php | 5 +- .../ORM/Query/LanguageRecognitionTest.php | 49 +++-- tests/Doctrine/Tests/ORM/Query/LexerTest.php | 5 +- .../ORM/Query/ParameterTypeInfererTest.php | 7 +- .../Tests/ORM/Query/ParserResultTest.php | 1 + tests/Doctrine/Tests/ORM/Query/ParserTest.php | 10 +- .../ORM/Query/QueryExpressionVisitorTest.php | 3 +- tests/Doctrine/Tests/ORM/Query/QueryTest.php | 102 ++++----- .../ORM/Query/SelectSqlGenerationTest.php | 68 +++--- .../ORM/Query/UpdateSqlGenerationTest.php | 8 +- tests/Doctrine/Tests/ORM/QueryBuilderTest.php | 200 +++++++++--------- .../AttachEntityListenersListenerTest.php | 4 + .../GenerateRepositoriesCommandTest.php | 1 + .../ORM/Tools/Console/MetadataFilterTest.php | 6 + .../Tests/ORM/Tools/EntityGeneratorTest.php | 190 +++++++++-------- .../Tools/EntityRepositoryGeneratorTest.php | 55 ++--- .../AbstractClassMetadataExporterTest.php | 22 +- .../AnnotationClassMetadataExporterTest.php | 2 +- .../Export/PhpClassMetadataExporterTest.php | 2 +- .../Export/XmlClassMetadataExporterTest.php | 2 +- .../Export/YamlClassMetadataExporterTest.php | 2 +- .../Doctrine.Tests.ORM.Tools.Export.User.php | 31 ++- .../Tools/ResolveTargetEntityListenerTest.php | 48 +++-- .../Tests/ORM/Tools/SchemaToolTest.php | 2 +- tests/Doctrine/Tests/ORM/Tools/SetupTest.php | 3 + 34 files changed, 645 insertions(+), 527 deletions(-) diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php index d8b96796145..5d73bffb894 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyArticle.php @@ -11,23 +11,34 @@ class LegacyArticle { /** + * @var int * @Id * @Column(name="iArticleId", type="integer") * @GeneratedValue(strategy="AUTO") */ - public $_id; - /** @Column(name="sTopic", type="string", length=255) */ - public $_topic; - /** @Column(name="sText", type="text") */ - public $_text; + public $id; + + /** + * @var string + * @Column(name="sTopic", type="string", length=255) + */ + public $topic; + + /** + * @var string + * @Column(name="sText", type="text") + */ + public $text; + /** + * @var LegacyUser * @ManyToOne(targetEntity="LegacyUser", inversedBy="_articles") * @JoinColumn(name="iUserId", referencedColumnName="iUserId") */ - public $_user; + public $user; public function setAuthor(LegacyUser $author): void { - $this->_user = $author; + $this->user = $author; } } diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php index b7abdb94d51..d32ee9e39aa 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php @@ -22,7 +22,7 @@ class LegacyUser public $_username; /** @Column(type="string", length=255, name="name") */ public $_name; - /** @OneToMany(targetEntity="LegacyArticle", mappedBy="_user") */ + /** @OneToMany(targetEntity="LegacyArticle", mappedBy="user") */ public $_articles; /** @OneToMany(targetEntity="LegacyUserReference", mappedBy="_source", cascade={"remove"}) */ public $_references; diff --git a/tests/Doctrine/Tests/ORM/EntityManagerTest.php b/tests/Doctrine/Tests/ORM/EntityManagerTest.php index 4c93ec88408..02dff949939 100644 --- a/tests/Doctrine/Tests/ORM/EntityManagerTest.php +++ b/tests/Doctrine/Tests/ORM/EntityManagerTest.php @@ -37,12 +37,12 @@ class EntityManagerTest extends OrmTestCase use VerifyDeprecations; /** @var EntityManager */ - private $_em; + private $entityManager; protected function setUp(): void { parent::setUp(); - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } /** @@ -50,45 +50,45 @@ protected function setUp(): void */ public function testIsOpen(): void { - $this->assertTrue($this->_em->isOpen()); - $this->_em->close(); - $this->assertFalse($this->_em->isOpen()); + $this->assertTrue($this->entityManager->isOpen()); + $this->entityManager->close(); + $this->assertFalse($this->entityManager->isOpen()); } public function testGetConnection(): void { - $this->assertInstanceOf(Connection::class, $this->_em->getConnection()); + $this->assertInstanceOf(Connection::class, $this->entityManager->getConnection()); } public function testGetMetadataFactory(): void { - $this->assertInstanceOf(ClassMetadataFactory::class, $this->_em->getMetadataFactory()); + $this->assertInstanceOf(ClassMetadataFactory::class, $this->entityManager->getMetadataFactory()); } public function testGetConfiguration(): void { - $this->assertInstanceOf(Configuration::class, $this->_em->getConfiguration()); + $this->assertInstanceOf(Configuration::class, $this->entityManager->getConfiguration()); } public function testGetUnitOfWork(): void { - $this->assertInstanceOf(UnitOfWork::class, $this->_em->getUnitOfWork()); + $this->assertInstanceOf(UnitOfWork::class, $this->entityManager->getUnitOfWork()); } public function testGetProxyFactory(): void { - $this->assertInstanceOf(ProxyFactory::class, $this->_em->getProxyFactory()); + $this->assertInstanceOf(ProxyFactory::class, $this->entityManager->getProxyFactory()); } public function testGetEventManager(): void { - $this->assertInstanceOf(EventManager::class, $this->_em->getEventManager()); + $this->assertInstanceOf(EventManager::class, $this->entityManager->getEventManager()); } public function testCreateNativeQuery(): void { $rsm = new ResultSetMapping(); - $query = $this->_em->createNativeQuery('SELECT foo', $rsm); + $query = $this->entityManager->createNativeQuery('SELECT foo', $rsm); $this->assertSame('SELECT foo', $query->getSql()); } @@ -99,21 +99,21 @@ public function testCreateNativeQuery(): void public function testCreateNamedNativeQuery(): void { $rsm = new ResultSetMapping(); - $this->_em->getConfiguration()->addNamedNativeQuery('foo', 'SELECT foo', $rsm); + $this->entityManager->getConfiguration()->addNamedNativeQuery('foo', 'SELECT foo', $rsm); - $query = $this->_em->createNamedNativeQuery('foo'); + $query = $this->entityManager->createNamedNativeQuery('foo'); $this->assertInstanceOf(NativeQuery::class, $query); } public function testCreateQueryBuilder(): void { - $this->assertInstanceOf(QueryBuilder::class, $this->_em->createQueryBuilder()); + $this->assertInstanceOf(QueryBuilder::class, $this->entityManager->createQueryBuilder()); } public function testCreateQueryBuilderAliasValid(): void { - $q = $this->_em->createQueryBuilder() + $q = $this->entityManager->createQueryBuilder() ->select('u')->from(CmsUser::class, 'u'); $q2 = clone $q; @@ -127,20 +127,20 @@ public function testCreateQueryBuilderAliasValid(): void public function testCreateQueryDqlIsOptional(): void { - $this->assertInstanceOf(Query::class, $this->_em->createQuery()); + $this->assertInstanceOf(Query::class, $this->entityManager->createQuery()); } public function testGetPartialReference(): void { - $user = $this->_em->getPartialReference(CmsUser::class, 42); - $this->assertTrue($this->_em->contains($user)); + $user = $this->entityManager->getPartialReference(CmsUser::class, 42); + $this->assertTrue($this->entityManager->contains($user)); $this->assertEquals(42, $user->id); $this->assertNull($user->getName()); } public function testCreateQuery(): void { - $q = $this->_em->createQuery('SELECT 1'); + $q = $this->entityManager->createQuery('SELECT 1'); $this->assertInstanceOf(Query::class, $q); $this->assertEquals('SELECT 1', $q->getDql()); } @@ -150,9 +150,9 @@ public function testCreateQuery(): void */ public function testCreateNamedQuery(): void { - $this->_em->getConfiguration()->addNamedQuery('foo', 'SELECT 1'); + $this->entityManager->getConfiguration()->addNamedQuery('foo', 'SELECT 1'); - $query = $this->_em->createNamedQuery('foo'); + $query = $this->entityManager->createNamedQuery('foo'); $this->assertInstanceOf(Query::class, $query); $this->assertEquals('SELECT 1', $query->getDql()); } @@ -176,7 +176,7 @@ public function testThrowsExceptionOnNonObjectValues($methodName): void $this->expectException(ORMInvalidArgumentException::class); $this->expectExceptionMessage('EntityManager#' . $methodName . '() expects parameter 1 to be an entity object, NULL given.'); - $this->_em->$methodName(null); + $this->entityManager->$methodName(null); } public static function dataAffectedByErrorIfClosedException() @@ -198,8 +198,8 @@ public function testAffectedByErrorIfClosedException(string $methodName): void $this->expectException(ORMException::class); $this->expectExceptionMessage('closed'); - $this->_em->close(); - $this->_em->$methodName(new stdClass()); + $this->entityManager->close(); + $this->entityManager->$methodName(new stdClass()); } /** @@ -207,7 +207,7 @@ public function testAffectedByErrorIfClosedException(string $methodName): void */ public function testTransactionalAcceptsReturn(): void { - $return = $this->_em->transactional(static function ($em) { + $return = $this->entityManager->transactional(static function ($em) { return 'foo'; }); @@ -216,7 +216,7 @@ public function testTransactionalAcceptsReturn(): void public function testTransactionalAcceptsVariousCallables(): void { - $this->assertSame('callback', $this->_em->transactional([$this, 'transactionalCallback'])); + $this->assertSame('callback', $this->entityManager->transactional([$this, 'transactionalCallback'])); } public function testTransactionalThrowsInvalidArgumentExceptionIfNonCallablePassed(): void @@ -224,12 +224,12 @@ public function testTransactionalThrowsInvalidArgumentExceptionIfNonCallablePass $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected argument of type "callable", got "object"'); - $this->_em->transactional($this); + $this->entityManager->transactional($this); } public function transactionalCallback($em) { - $this->assertSame($this->_em, $em); + $this->assertSame($this->entityManager, $em); return 'callback'; } @@ -250,7 +250,7 @@ public function testCreateInvalidConnection(): void public function testTransactionalReThrowsThrowables(): void { try { - $this->_em->transactional(static function (): void { + $this->entityManager->transactional(static function (): void { (static function (array $value): void { // this only serves as an IIFE that throws a `TypeError` })(null); @@ -258,7 +258,7 @@ public function testTransactionalReThrowsThrowables(): void self::fail('TypeError expected to be thrown'); } catch (TypeError $ignored) { - self::assertFalse($this->_em->isOpen()); + self::assertFalse($this->entityManager->isOpen()); } } @@ -271,7 +271,7 @@ public function testClearManagerWithObject(): void $this->expectException(ORMInvalidArgumentException::class); - $this->_em->clear($entity); + $this->entityManager->clear($entity); } /** @@ -281,7 +281,7 @@ public function testClearManagerWithUnknownEntityName(): void { $this->expectException(MappingException::class); - $this->_em->clear(uniqid('nonExisting', true)); + $this->entityManager->clear(uniqid('nonExisting', true)); } /** @@ -289,17 +289,17 @@ public function testClearManagerWithUnknownEntityName(): void */ public function testClearManagerWithProxyClassName(): void { - $proxy = $this->_em->getReference(Country::class, ['id' => random_int(457, 100000)]); + $proxy = $this->entityManager->getReference(Country::class, ['id' => random_int(457, 100000)]); $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); - $this->assertTrue($this->_em->contains($entity)); + $this->assertTrue($this->entityManager->contains($entity)); - $this->_em->clear(get_class($proxy)); + $this->entityManager->clear(get_class($proxy)); - $this->assertFalse($this->_em->contains($entity)); + $this->assertFalse($this->entityManager->contains($entity)); } /** @@ -309,59 +309,59 @@ public function testClearManagerWithNullValue(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); - $this->assertTrue($this->_em->contains($entity)); + $this->assertTrue($this->entityManager->contains($entity)); - $this->_em->clear(null); + $this->entityManager->clear(null); - $this->assertFalse($this->_em->contains($entity)); + $this->assertFalse($this->entityManager->contains($entity)); } public function testDeprecatedClearWithArguments(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); $this->expectDeprecationMessageSame('Calling Doctrine\ORM\EntityManager::clear() with any arguments to clear specific entities is deprecated and will not be supported in Doctrine ORM 3.0.'); - $this->_em->clear(Country::class); + $this->entityManager->clear(Country::class); } public function testDeprecatedFlushWithArguments(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); $this->expectDeprecationMessageSame('Calling Doctrine\ORM\EntityManager::flush() with any arguments to flush specific entities is deprecated and will not be supported in Doctrine ORM 3.0.'); - $this->_em->flush($entity); + $this->entityManager->flush($entity); } public function testDeprecatedMerge(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); $this->expectDeprecationMessageSame('Method Doctrine\ORM\EntityManager::merge() is deprecated and will be removed in Doctrine ORM 3.0.'); - $this->_em->merge($entity); + $this->entityManager->merge($entity); } public function testDeprecatedDetach(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); $this->expectDeprecationMessageSame('Method Doctrine\ORM\EntityManager::detach() is deprecated and will be removed in Doctrine ORM 3.0.'); - $this->_em->detach($entity); + $this->entityManager->detach($entity); } public function testDeprecatedCopy(): void { $entity = new Country(456, 'United Kingdom'); - $this->_em->persist($entity); + $this->entityManager->persist($entity); try { $this->expectDeprecationMessageSame('Method Doctrine\ORM\EntityManager::copy() is deprecated and will be removed in Doctrine ORM 3.0.'); - $this->_em->copy($entity); + $this->entityManager->copy($entity); } catch (BadMethodCallException $e) { // do nothing } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php index 6ebda56b58a..8af29adb6df 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php @@ -107,14 +107,14 @@ public function loadFixture(): void $this->_em->persist($user2); $this->_em->persist($user3); - $article1 = new Models\Legacy\LegacyArticle(); - $article1->_topic = 'Test'; - $article1->_text = 'Test'; + $article1 = new Models\Legacy\LegacyArticle(); + $article1->topic = 'Test'; + $article1->text = 'Test'; $article1->setAuthor($user1); - $article2 = new Models\Legacy\LegacyArticle(); - $article2->_topic = 'Test'; - $article2->_text = 'Test'; + $article2 = new Models\Legacy\LegacyArticle(); + $article2->topic = 'Test'; + $article2->text = 'Test'; $article2->setAuthor($user1); $this->_em->persist($article1); diff --git a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php index 33302b8f6ac..a33375fff89 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ResultSetMappingTest.php @@ -25,13 +25,13 @@ class ResultSetMappingTest extends OrmTestCase private $_rsm; /** @var EntityManager */ - private $_em; + private $entityManager; protected function setUp(): void { parent::setUp(); - $this->_rsm = new ResultSetMapping(); - $this->_em = $this->getTestEntityManager(); + $this->_rsm = new ResultSetMapping(); + $this->entityManager = $this->getTestEntityManager(); } /** @@ -168,7 +168,7 @@ public function testAddNamedNativeQueryResultSetMapping(): void $queryMapping = $cm->getNamedNativeQuery('find-all'); - $rsm = new ResultSetMappingBuilder($this->_em); + $rsm = new ResultSetMappingBuilder($this->entityManager); $rsm->addNamedNativeQueryMapping($cm, $queryMapping); $this->assertEquals('scalarColumn', $rsm->getScalarAlias('scalarColumn')); @@ -215,7 +215,7 @@ public function testAddNamedNativeQueryResultSetMappingWithoutFields(): void ); $queryMapping = $cm->getNamedNativeQuery('find-all'); - $rsm = new ResultSetMappingBuilder($this->_em); + $rsm = new ResultSetMappingBuilder($this->entityManager); $rsm->addNamedNativeQueryMapping($cm, $queryMapping); @@ -249,7 +249,7 @@ public function testAddNamedNativeQueryResultClass(): void ); $queryMapping = $cm->getNamedNativeQuery('find-all'); - $rsm = new ResultSetMappingBuilder($this->_em); + $rsm = new ResultSetMappingBuilder($this->entityManager); $rsm->addNamedNativeQueryMapping($cm, $queryMapping); diff --git a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php index afa0de1017c..015ac665c3a 100644 --- a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php @@ -13,13 +13,16 @@ */ class AssignedGeneratorTest extends OrmTestCase { - private $_em; - private $_assignedGen; + /** @var EntityManagerInterface */ + private $entityManager; + + /** @var AssignedGenerator */ + private $assignedGen; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); - $this->_assignedGen = new AssignedGenerator(); + $this->entityManager = $this->getTestEntityManager(); + $this->assignedGen = new AssignedGenerator(); } /** @@ -29,7 +32,7 @@ public function testThrowsExceptionIfIdNotAssigned($entity): void { $this->expectException(ORMException::class); - $this->_assignedGen->generate($this->_em, $entity); + $this->assignedGen->generate($this->entityManager, $entity); } public function entitiesWithoutId(): array @@ -44,13 +47,13 @@ public function testCorrectIdGeneration(): void { $entity = new AssignedSingleIdEntity(); $entity->myId = 1; - $id = $this->_assignedGen->generate($this->_em, $entity); + $id = $this->assignedGen->generate($this->entityManager, $entity); $this->assertEquals(['myId' => 1], $id); $entity = new AssignedCompositeIdEntity(); $entity->myId2 = 2; $entity->myId1 = 4; - $id = $this->_assignedGen->generate($this->_em, $entity); + $id = $this->assignedGen->generate($this->entityManager, $entity); $this->assertEquals(['myId1' => 4, 'myId2' => 2], $id); } } diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php index b54861adba6..64729cc062a 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\Query\QueryException; use Doctrine\Tests\Models\CMS\CmsAddress; @@ -21,16 +22,17 @@ */ class CustomTreeWalkersTest extends OrmTestCase { - private $_em; + /** @var EntityManagerInterface */ + private $entityManager; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } public function generateSql($dqlToBeTested, $treeWalkers, $outputWalker) { - $query = $this->_em->createQuery($dqlToBeTested); + $query = $this->entityManager->createQuery($dqlToBeTested); $query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, $treeWalkers) ->useQueryCache(false); diff --git a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php index 5c0e8421cf3..d2b76a63717 100644 --- a/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Query; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\Tests\OrmTestCase; use Exception; @@ -18,17 +19,18 @@ */ class DeleteSqlGenerationTest extends OrmTestCase { - private $_em; + /** @var EntityManagerInterface */ + private $entityManager; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } - public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void + public function assertSqlGeneration(string $dqlToBeTested, string $sqlToBeConfirmed): void { try { - $query = $this->_em->createQuery($dqlToBeTested); + $query = $this->entityManager->createQuery($dqlToBeTested); parent::assertEquals($sqlToBeConfirmed, $query->getSql()); $query->free(); } catch (Exception $e) { diff --git a/tests/Doctrine/Tests/ORM/Query/ExprTest.php b/tests/Doctrine/Tests/ORM/Query/ExprTest.php index 9b73052d6a1..d71339bfcf5 100644 --- a/tests/Doctrine/Tests/ORM/Query/ExprTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ExprTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Query; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\Expr; use Doctrine\Tests\Models\Company\CompanyEmployee; use Doctrine\Tests\OrmTestCase; @@ -17,165 +18,166 @@ */ class ExprTest extends OrmTestCase { - private $_em; + /** @var EntityManagerInterface */ + private $entityManager; /** @var Expr */ - private $_expr; + private $expr; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); - $this->_expr = new Expr(); + $this->entityManager = $this->getTestEntityManager(); + $this->expr = new Expr(); } public function testAvgExpr(): void { - $this->assertEquals('AVG(u.id)', (string) $this->_expr->avg('u.id')); + $this->assertEquals('AVG(u.id)', (string) $this->expr->avg('u.id')); } public function testMaxExpr(): void { - $this->assertEquals('MAX(u.id)', (string) $this->_expr->max('u.id')); + $this->assertEquals('MAX(u.id)', (string) $this->expr->max('u.id')); } public function testMinExpr(): void { - $this->assertEquals('MIN(u.id)', (string) $this->_expr->min('u.id')); + $this->assertEquals('MIN(u.id)', (string) $this->expr->min('u.id')); } public function testCountExpr(): void { - $this->assertEquals('MAX(u.id)', (string) $this->_expr->max('u.id')); + $this->assertEquals('MAX(u.id)', (string) $this->expr->max('u.id')); } public function testCountDistinctExpr(): void { - $this->assertEquals('COUNT(DISTINCT u.id)', (string) $this->_expr->countDistinct('u.id')); + $this->assertEquals('COUNT(DISTINCT u.id)', (string) $this->expr->countDistinct('u.id')); } public function testCountDistinctExprMulti(): void { - $this->assertEquals('COUNT(DISTINCT u.id, u.name)', (string) $this->_expr->countDistinct('u.id', 'u.name')); + $this->assertEquals('COUNT(DISTINCT u.id, u.name)', (string) $this->expr->countDistinct('u.id', 'u.name')); } public function testExistsExpr(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from('User', 'u')->where('u.name = ?1'); - $this->assertEquals('EXISTS(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->_expr->exists($qb)); + $this->assertEquals('EXISTS(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->expr->exists($qb)); } public function testAllExpr(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from('User', 'u')->where('u.name = ?1'); - $this->assertEquals('ALL(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->_expr->all($qb)); + $this->assertEquals('ALL(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->expr->all($qb)); } public function testSomeExpr(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from('User', 'u')->where('u.name = ?1'); - $this->assertEquals('SOME(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->_expr->some($qb)); + $this->assertEquals('SOME(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->expr->some($qb)); } public function testAnyExpr(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from('User', 'u')->where('u.name = ?1'); - $this->assertEquals('ANY(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->_expr->any($qb)); + $this->assertEquals('ANY(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->expr->any($qb)); } public function testNotExpr(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from('User', 'u')->where('u.name = ?1'); - $this->assertEquals('NOT(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->_expr->not($qb)); + $this->assertEquals('NOT(SELECT u FROM User u WHERE u.name = ?1)', (string) $this->expr->not($qb)); } public function testAndExpr(): void { - $this->assertEquals('1 = 1 AND 2 = 2', (string) $this->_expr->andX((string) $this->_expr->eq(1, 1), (string) $this->_expr->eq(2, 2))); + $this->assertEquals('1 = 1 AND 2 = 2', (string) $this->expr->andX((string) $this->expr->eq(1, 1), (string) $this->expr->eq(2, 2))); } public function testIntelligentParenthesisPreventionAndExpr(): void { $this->assertEquals( '1 = 1 AND 2 = 2', - (string) $this->_expr->andX($this->_expr->orX($this->_expr->andX($this->_expr->eq(1, 1))), (string) $this->_expr->eq(2, 2)) + (string) $this->expr->andX($this->expr->orX($this->expr->andX($this->expr->eq(1, 1))), (string) $this->expr->eq(2, 2)) ); } public function testOrExpr(): void { - $this->assertEquals('1 = 1 OR 2 = 2', (string) $this->_expr->orX((string) $this->_expr->eq(1, 1), (string) $this->_expr->eq(2, 2))); + $this->assertEquals('1 = 1 OR 2 = 2', (string) $this->expr->orX((string) $this->expr->eq(1, 1), (string) $this->expr->eq(2, 2))); } public function testAbsExpr(): void { - $this->assertEquals('ABS(1)', (string) $this->_expr->abs(1)); + $this->assertEquals('ABS(1)', (string) $this->expr->abs(1)); } public function testProdExpr(): void { - $this->assertEquals('1 * 2', (string) $this->_expr->prod(1, 2)); + $this->assertEquals('1 * 2', (string) $this->expr->prod(1, 2)); } public function testDiffExpr(): void { - $this->assertEquals('1 - 2', (string) $this->_expr->diff(1, 2)); + $this->assertEquals('1 - 2', (string) $this->expr->diff(1, 2)); } public function testSumExpr(): void { - $this->assertEquals('1 + 2', (string) $this->_expr->sum(1, 2)); + $this->assertEquals('1 + 2', (string) $this->expr->sum(1, 2)); } public function testQuotientExpr(): void { - $this->assertEquals('10 / 2', (string) $this->_expr->quot(10, 2)); + $this->assertEquals('10 / 2', (string) $this->expr->quot(10, 2)); } public function testScopeInArithmeticExpr(): void { - $this->assertEquals('(100 - 20) / 2', (string) $this->_expr->quot($this->_expr->diff(100, 20), 2)); - $this->assertEquals('100 - (20 / 2)', (string) $this->_expr->diff(100, $this->_expr->quot(20, 2))); + $this->assertEquals('(100 - 20) / 2', (string) $this->expr->quot($this->expr->diff(100, 20), 2)); + $this->assertEquals('100 - (20 / 2)', (string) $this->expr->diff(100, $this->expr->quot(20, 2))); } public function testSquareRootExpr(): void { - $this->assertEquals('SQRT(1)', (string) $this->_expr->sqrt(1)); + $this->assertEquals('SQRT(1)', (string) $this->expr->sqrt(1)); } public function testEqualExpr(): void { - $this->assertEquals('1 = 1', (string) $this->_expr->eq(1, 1)); + $this->assertEquals('1 = 1', (string) $this->expr->eq(1, 1)); } public function testLikeExpr(): void { - $this->assertEquals('a.description LIKE :description', (string) $this->_expr->like('a.description', ':description')); + $this->assertEquals('a.description LIKE :description', (string) $this->expr->like('a.description', ':description')); } public function testNotLikeExpr(): void { - $this->assertEquals('a.description NOT LIKE :description', (string) $this->_expr->notLike('a.description', ':description')); + $this->assertEquals('a.description NOT LIKE :description', (string) $this->expr->notLike('a.description', ':description')); } public function testConcatExpr(): void { - $this->assertEquals('CONCAT(u.first_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.last_name')); - $this->assertEquals('CONCAT(u.first_name, u.middle_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.middle_name', 'u.last_name')); + $this->assertEquals('CONCAT(u.first_name, u.last_name)', (string) $this->expr->concat('u.first_name', 'u.last_name')); + $this->assertEquals('CONCAT(u.first_name, u.middle_name, u.last_name)', (string) $this->expr->concat('u.first_name', 'u.middle_name', 'u.last_name')); } public function testSubstringExpr(): void { - $this->assertEquals('SUBSTRING(a.title, 0, 25)', (string) $this->_expr->substring('a.title', 0, 25)); + $this->assertEquals('SUBSTRING(a.title, 0, 25)', (string) $this->expr->substring('a.title', 0, 25)); } /** @@ -184,42 +186,42 @@ public function testSubstringExpr(): void */ public function testSubstringExprAcceptsTwoArguments(): void { - $this->assertEquals('SUBSTRING(a.title, 5)', (string) $this->_expr->substring('a.title', 5)); + $this->assertEquals('SUBSTRING(a.title, 5)', (string) $this->expr->substring('a.title', 5)); } public function testLowerExpr(): void { - $this->assertEquals('LOWER(u.first_name)', (string) $this->_expr->lower('u.first_name')); + $this->assertEquals('LOWER(u.first_name)', (string) $this->expr->lower('u.first_name')); } public function testUpperExpr(): void { - $this->assertEquals('UPPER(u.first_name)', (string) $this->_expr->upper('u.first_name')); + $this->assertEquals('UPPER(u.first_name)', (string) $this->expr->upper('u.first_name')); } public function testLengthExpr(): void { - $this->assertEquals('LENGTH(u.first_name)', (string) $this->_expr->length('u.first_name')); + $this->assertEquals('LENGTH(u.first_name)', (string) $this->expr->length('u.first_name')); } public function testGreaterThanExpr(): void { - $this->assertEquals('5 > 2', (string) $this->_expr->gt(5, 2)); + $this->assertEquals('5 > 2', (string) $this->expr->gt(5, 2)); } public function testLessThanExpr(): void { - $this->assertEquals('2 < 5', (string) $this->_expr->lt(2, 5)); + $this->assertEquals('2 < 5', (string) $this->expr->lt(2, 5)); } public function testStringLiteralExpr(): void { - $this->assertEquals("'word'", (string) $this->_expr->literal('word')); + $this->assertEquals("'word'", (string) $this->expr->literal('word')); } public function testNumericLiteralExpr(): void { - $this->assertEquals(5, (string) $this->_expr->literal(5)); + $this->assertEquals(5, (string) $this->expr->literal(5)); } /** @@ -228,47 +230,47 @@ public function testNumericLiteralExpr(): void */ public function testLiteralExprProperlyQuotesStrings(): void { - $this->assertEquals("'00010001'", (string) $this->_expr->literal('00010001')); + $this->assertEquals("'00010001'", (string) $this->expr->literal('00010001')); } public function testGreaterThanOrEqualToExpr(): void { - $this->assertEquals('5 >= 2', (string) $this->_expr->gte(5, 2)); + $this->assertEquals('5 >= 2', (string) $this->expr->gte(5, 2)); } public function testLessThanOrEqualTo(): void { - $this->assertEquals('2 <= 5', (string) $this->_expr->lte(2, 5)); + $this->assertEquals('2 <= 5', (string) $this->expr->lte(2, 5)); } public function testBetweenExpr(): void { - $this->assertEquals('u.id BETWEEN 3 AND 6', (string) $this->_expr->between('u.id', 3, 6)); + $this->assertEquals('u.id BETWEEN 3 AND 6', (string) $this->expr->between('u.id', 3, 6)); } public function testTrimExpr(): void { - $this->assertEquals('TRIM(u.id)', (string) $this->_expr->trim('u.id')); + $this->assertEquals('TRIM(u.id)', (string) $this->expr->trim('u.id')); } public function testIsNullExpr(): void { - $this->assertEquals('u.id IS NULL', (string) $this->_expr->isNull('u.id')); + $this->assertEquals('u.id IS NULL', (string) $this->expr->isNull('u.id')); } public function testIsNotNullExpr(): void { - $this->assertEquals('u.id IS NOT NULL', (string) $this->_expr->isNotNull('u.id')); + $this->assertEquals('u.id IS NOT NULL', (string) $this->expr->isNotNull('u.id')); } public function testIsInstanceOfExpr(): void { - $this->assertEquals('u INSTANCE OF Doctrine\Tests\Models\Company\CompanyEmployee', (string) $this->_expr->isInstanceOf('u', CompanyEmployee::class)); + $this->assertEquals('u INSTANCE OF Doctrine\Tests\Models\Company\CompanyEmployee', (string) $this->expr->isInstanceOf('u', CompanyEmployee::class)); } public function testIsMemberOfExpr(): void { - $this->assertEquals(':groupId MEMBER OF u.groups', (string) $this->_expr->isMemberOf(':groupId', 'u.groups')); + $this->assertEquals(':groupId MEMBER OF u.groups', (string) $this->expr->isMemberOf(':groupId', 'u.groups')); } public function provideIterableValue(): Generator @@ -296,7 +298,7 @@ public function provideLiteralIterableValue(): Generator */ public function testInExpr(iterable $value): void { - self::assertEquals('u.id IN(1, 2, 3)', (string) $this->_expr->in('u.id', $value)); + self::assertEquals('u.id IN(1, 2, 3)', (string) $this->expr->in('u.id', $value)); } /** @@ -304,7 +306,7 @@ public function testInExpr(iterable $value): void */ public function testInLiteralExpr(iterable $value): void { - self::assertEquals("u.type IN('foo', 'bar')", (string) $this->_expr->in('u.type', $value)); + self::assertEquals("u.type IN('foo', 'bar')", (string) $this->expr->in('u.type', $value)); } /** @@ -312,7 +314,7 @@ public function testInLiteralExpr(iterable $value): void */ public function testNotInExpr(iterable $value): void { - self::assertEquals('u.id NOT IN(1, 2, 3)', (string) $this->_expr->notIn('u.id', $value)); + self::assertEquals('u.id NOT IN(1, 2, 3)', (string) $this->expr->notIn('u.id', $value)); } /** @@ -320,34 +322,34 @@ public function testNotInExpr(iterable $value): void */ public function testNotInLiteralExpr(iterable $value): void { - self::assertEquals("u.type NOT IN('foo', 'bar')", (string) $this->_expr->notIn('u.type', $value)); + self::assertEquals("u.type NOT IN('foo', 'bar')", (string) $this->expr->notIn('u.type', $value)); } public function testAndxOrxExpr(): void { - $andExpr = $this->_expr->andX(); - $andExpr->add($this->_expr->eq(1, 1)); - $andExpr->add($this->_expr->lt(1, 5)); + $andExpr = $this->expr->andX(); + $andExpr->add($this->expr->eq(1, 1)); + $andExpr->add($this->expr->lt(1, 5)); - $orExpr = $this->_expr->orX(); + $orExpr = $this->expr->orX(); $orExpr->add($andExpr); - $orExpr->add($this->_expr->eq(1, 1)); + $orExpr->add($this->expr->eq(1, 1)); $this->assertEquals('(1 = 1 AND 1 < 5) OR 1 = 1', (string) $orExpr); } public function testOrxExpr(): void { - $orExpr = $this->_expr->orX(); - $orExpr->add($this->_expr->eq(1, 1)); - $orExpr->add($this->_expr->lt(1, 5)); + $orExpr = $this->expr->orX(); + $orExpr->add($this->expr->eq(1, 1)); + $orExpr->add($this->expr->lt(1, 5)); $this->assertEquals('1 = 1 OR 1 < 5', (string) $orExpr); } public function testOrderByCountExpr(): void { - $orderExpr = $this->_expr->desc('u.username'); + $orderExpr = $this->expr->desc('u.username'); $this->assertEquals($orderExpr->count(), 1); $this->assertEquals('u.username DESC', (string) $orderExpr); @@ -355,21 +357,21 @@ public function testOrderByCountExpr(): void public function testOrderByOrder(): void { - $orderExpr = $this->_expr->desc('u.username'); + $orderExpr = $this->expr->desc('u.username'); $this->assertEquals('u.username DESC', (string) $orderExpr); } public function testOrderByAsc(): void { - $orderExpr = $this->_expr->asc('u.username'); + $orderExpr = $this->expr->asc('u.username'); $this->assertEquals('u.username ASC', (string) $orderExpr); } public function testAddThrowsException(): void { $this->expectException('InvalidArgumentException'); - $orExpr = $this->_expr->orX(); - $orExpr->add($this->_expr->quot(5, 2)); + $orExpr = $this->expr->orX(); + $orExpr->add($this->expr->quot(5, 2)); } /** @@ -377,8 +379,8 @@ public function testAddThrowsException(): void */ public function testBooleanLiteral(): void { - $this->assertEquals('true', $this->_expr->literal(true)); - $this->assertEquals('false', $this->_expr->literal(false)); + $this->assertEquals('true', $this->expr->literal(true)); + $this->assertEquals('false', $this->expr->literal(false)); } /** @@ -445,15 +447,15 @@ public function testExpressionGetter(): void public function testAddEmpty(): void { - $andExpr = $this->_expr->andX(); - $andExpr->add($this->_expr->andX()); + $andExpr = $this->expr->andX(); + $andExpr->add($this->expr->andX()); $this->assertEquals(0, $andExpr->count()); } public function testAddNull(): void { - $andExpr = $this->_expr->andX(); + $andExpr = $this->expr->andX(); $andExpr->add(null); $this->assertEquals(0, $andExpr->count()); diff --git a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php index 04dbd38c3bf..4629b46566f 100644 --- a/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/FilterCollectionTest.php @@ -80,7 +80,10 @@ public function testGetFilter(): void class MyFilter extends SQLFilter { - public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) + /** + * {@inheritDoc} + */ + public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias): string { // getParameter applies quoting automatically return $targetTableAlias . '.id = ' . $this->getParameter('id'); diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index 4d2da455f41..037105644b1 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; +use Doctrine\ORM\Query\ParserResult; use Doctrine\ORM\Query\QueryException; use Doctrine\Tests\Mocks\MockTreeWalker; use Doctrine\Tests\OrmTestCase; @@ -15,11 +16,11 @@ class LanguageRecognitionTest extends OrmTestCase { /** @var EntityManagerInterface */ - private $_em; + private $entityManager; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } public function assertValidDQL($dql, $debug = false): void @@ -52,9 +53,12 @@ public function assertInvalidDQL($dql, $debug = false): void } } - public function parseDql($dql, $hints = []) + /** + * @psalm-param array $hints + */ + public function parseDql(string $dql, array $hints = []): ParserResult { - $query = $this->_em->createQuery($dql); + $query = $this->entityManager->createQuery($dql); $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); $query->setDQL($dql); @@ -88,11 +92,11 @@ public function testSelectSingleComponentWithAsterisk(): void /** * @dataProvider invalidDQL */ - public function testRejectsInvalidDQL($dql): void + public function testRejectsInvalidDQL(string $dql): void { $this->expectException(QueryException::class); - $this->_em->getConfiguration()->setEntityNamespaces( + $this->entityManager->getConfiguration()->setEntityNamespaces( [ 'Unknown' => 'Unknown', 'CMS' => 'Doctrine\Tests\Models\CMS', @@ -102,7 +106,10 @@ public function testRejectsInvalidDQL($dql): void $this->parseDql($dql); } - public function invalidDQL() + /** + * @psalm-return list + */ + public function invalidDQL(): array { return [ @@ -580,7 +587,7 @@ public function testInputParameterInSelect(): void */ public function testCustomFunctionsReturningStringInStringPrimary(): void { - $this->_em->getConfiguration()->addCustomStringFunction('CC', Query\AST\Functions\ConcatFunction::class); + $this->entityManager->getConfiguration()->addCustomStringFunction('CC', Query\AST\Functions\ConcatFunction::class); $this->assertValidDQL("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE CC('%', u.name) LIKE '%foo%'", true); } @@ -725,18 +732,36 @@ public function testStringPrimaryAcceptsAggregateExpression(): void /** @Entity */ class DQLKeywordsModelUser { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; - /** @OneToOne(targetEntity="DQLKeywordsModelGroup") */ + + /** + * @var DQLKeywordsModelGroup + * @OneToOne(targetEntity="DQLKeywordsModelGroup") + */ private $group; } /** @Entity */ class DQLKeywordsModelGroup { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; - /** @Column */ + + /** + * @var string + * @Column + */ private $from; } diff --git a/tests/Doctrine/Tests/ORM/Query/LexerTest.php b/tests/Doctrine/Tests/ORM/Query/LexerTest.php index a23ad8f3581..585160c84fe 100644 --- a/tests/Doctrine/Tests/ORM/Query/LexerTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LexerTest.php @@ -9,8 +9,6 @@ class LexerTest extends OrmTestCase { - private $_lexer; - /** * @dataProvider provideTokens */ @@ -229,7 +227,8 @@ public function testScannerTokenizesASimpleQueryCorrectly(): void $this->assertFalse($lexer->moveNext()); } - public function provideTokens() + /** @psalm-return list */ + public function provideTokens(): array { return [ [Lexer::T_IDENTIFIER, 'u'], // one char diff --git a/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php b/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php index 2eb4e8eed0a..c6b7578f537 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php @@ -15,7 +15,8 @@ class ParameterTypeInfererTest extends OrmTestCase { - public function providerParameterTypeInferer() + /** @psalm-return list */ + public function providerParameterTypeInferer(): array { return [ [1, Type::INTEGER], @@ -33,9 +34,11 @@ public function providerParameterTypeInferer() } /** + * @param mixed $value + * @param int|string $expected + * * @dataProvider providerParameterTypeInferer */ - public function testParameterTypeInferer($value, $expected): void { $this->assertEquals($expected, ParameterTypeInferer::inferType($value)); diff --git a/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php b/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php index a7cc5e40c90..2bfc593d606 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php @@ -11,6 +11,7 @@ class ParserResultTest extends TestCase { + /** @var ParserResult */ public $parserResult; protected function setUp(): void diff --git a/tests/Doctrine/Tests/ORM/Query/ParserTest.php b/tests/Doctrine/Tests/ORM/Query/ParserTest.php index 70d22de8bfb..99e5fca3e00 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParserTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParserTest.php @@ -78,7 +78,7 @@ public function testAbstractSchemaNameSupportsNamespaceAliasWithRelativeClassnam * @covers Doctrine\ORM\Query\Parser::match * @group DDC-3701 */ - public function testMatch($expectedToken, $inputString): void + public function testMatch(int $expectedToken, string $inputString): void { $parser = $this->createParser($inputString); @@ -92,7 +92,7 @@ public function testMatch($expectedToken, $inputString): void * @covers Doctrine\ORM\Query\Parser::match * @group DDC-3701 */ - public function testMatchFailure($expectedToken, $inputString): void + public function testMatchFailure(int $expectedToken, string $inputString): void { $this->expectException(QueryException::class); @@ -101,6 +101,7 @@ public function testMatchFailure($expectedToken, $inputString): void $parser->match($expectedToken); } + /** @psalm-return list */ public function validMatches() { /* @@ -121,7 +122,8 @@ public function validMatches() ]; } - public function invalidMatches() + /** @psalm-return list */ + public function invalidMatches(): array { return [ [Lexer::T_DOT, 'ALL'], // ALL is a terminal string (reserved keyword) and also possibly an identifier @@ -154,7 +156,7 @@ public function testNullLookahead(): void $parser->match(Lexer::T_SELECT); } - private function createParser($dql) + private function createParser(string $dql): Parser { $query = new Query($this->getTestEntityManager()); $query->setDQL($dql); diff --git a/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php b/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php index c7d0e065dae..45d5150b387 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php @@ -39,7 +39,8 @@ public function testWalkComparison(CriteriaComparison $criteriaExpr, $queryExpr, } } - public function comparisonData() + /** @psalm-return list_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } public function testGetParameters(): void { - $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); + $query = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); $parameters = new ArrayCollection(); @@ -49,7 +49,7 @@ public function testGetParameters(): void public function testGetParametersHasSomeAlready(): void { - $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); + $query = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); $query->setParameter(2, 84); $parameters = new ArrayCollection(); @@ -60,7 +60,7 @@ public function testGetParametersHasSomeAlready(): void public function testSetParameters(): void { - $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); + $query = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); $parameters = new ArrayCollection(); $parameters->add(new Parameter(1, 'foo')); @@ -73,7 +73,7 @@ public function testSetParameters(): void public function testFree(): void { - $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); + $query = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'); $query->setParameter(2, 84, PDO::PARAM_INT); $query->free(); @@ -85,7 +85,7 @@ public function testClone(): void { $dql = 'select u from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1'; - $query = $this->_em->createQuery($dql); + $query = $this->entityManager->createQuery($dql); $query->setParameter(2, 84, PDO::PARAM_INT); $query->setHint('foo', 'bar'); @@ -98,7 +98,7 @@ public function testClone(): void public function testFluentQueryInterface(): void { - $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); + $q = $this->entityManager->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); $q2 = $q->expireQueryCache(true) ->setQueryCacheLifetime(3600) ->setQueryCacheDriver(null) @@ -121,7 +121,7 @@ public function testFluentQueryInterface(): void */ public function testHints(): void { - $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); + $q = $this->entityManager->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); $q->setHint('foo', 'bar')->setHint('bar', 'baz'); $this->assertEquals('bar', $q->getHint('foo')); @@ -136,17 +136,17 @@ public function testHints(): void */ public function testQueryDefaultResultCache(): void { - $this->_em->getConfiguration()->setResultCacheImpl(new ArrayCache()); - $q = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); + $this->entityManager->getConfiguration()->setResultCacheImpl(new ArrayCache()); + $q = $this->entityManager->createQuery('select a from Doctrine\Tests\Models\CMS\CmsArticle a'); $q->enableResultCache(); - $this->assertSame($this->_em->getConfiguration()->getResultCacheImpl(), $q->getQueryCacheProfile()->getResultCacheDriver()); + $this->assertSame($this->entityManager->getConfiguration()->getResultCacheImpl(), $q->getQueryCacheProfile()->getResultCacheDriver()); } public function testIterateWithNoDistinctAndWrongSelectClause(): void { $this->expectException(QueryException::class); - $q = $this->_em->createQuery('select u, a from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); + $q = $this->entityManager->createQuery('select u, a from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); $q->iterate(); } @@ -154,7 +154,7 @@ public function testToIterableWithNoDistinctAndWrongSelectClause(): void { $this->expectException(QueryException::class); - $q = $this->_em->createQuery('select u, a from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); + $q = $this->entityManager->createQuery('select u, a from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); $q->toIterable(); } @@ -162,7 +162,7 @@ public function testIterateWithNoDistinctAndWithValidSelectClause(): void { $this->expectException(QueryException::class); - $q = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); + $q = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); $q->iterate(); } @@ -170,20 +170,20 @@ public function testToIterableWithNoDistinctAndWithValidSelectClause(): void { $this->expectException(QueryException::class); - $q = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); + $q = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); $q->toIterable(); } public function testIterateWithDistinct(): void { - $q = $this->_em->createQuery('SELECT DISTINCT u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); + $q = $this->entityManager->createQuery('SELECT DISTINCT u from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); self::assertInstanceOf(IterableResult::class, $q->iterate()); } public function testIterateEmptyResult(): void { - $q = $this->_em->createQuery('SELECT u from Doctrine\Tests\Models\CMS\CmsUser u'); + $q = $this->entityManager->createQuery('SELECT u from Doctrine\Tests\Models\CMS\CmsUser u'); // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedForeach foreach ($q->toIterable() as $item) { @@ -203,7 +203,7 @@ public function testCollectionParameters(): void 9 => 'St Julien', ]; - $query = $this->_em + $query = $this->entityManager ->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)') ->setParameter('cities', $cities); @@ -236,7 +236,7 @@ public function provideProcessParameterValueIterable(): Generator */ public function testProcessParameterValueIterable(iterable $cities): void { - $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)'); + $query = $this->entityManager->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)'); self::assertEquals( [ 0 => 'Paris', @@ -252,7 +252,7 @@ public function testProcessParameterValueWithIterableEntityShouldNotBeTreatedAsI $group = new CmsGroup(); $group->id = 1; - $query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.group IN (:group)'); + $query = $this->entityManager->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.group IN (:group)'); self::assertEquals(1, $query->processParameterValue($group)); } @@ -261,16 +261,16 @@ public function testProcessParameterValueWithIterableEntityShouldNotBeTreatedAsI */ public function testProcessParameterValueClassMetadata(): void { - $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)'); + $query = $this->entityManager->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.city IN (:cities)'); $this->assertEquals( CmsAddress::class, - $query->processParameterValue($this->_em->getClassMetadata(CmsAddress::class)) + $query->processParameterValue($this->entityManager->getClassMetadata(CmsAddress::class)) ); } public function testProcessParameterValueObject(): void { - $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.user = :user'); + $query = $this->entityManager->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.user = :user'); $user = new CmsUser(); $user->id = 12345; @@ -284,9 +284,9 @@ public function testProcessParameterValueValueObjectWithDriverChain(): void { $driverChain = new MappingDriverChain(); $driverChain->addDriver($this->createAnnotationDriver(), 'Foo'); - $this->_em->getConfiguration()->setMetadataDriverImpl($driverChain); + $this->entityManager->getConfiguration()->setMetadataDriverImpl($driverChain); - $query = $this->_em->createQuery(); + $query = $this->entityManager->createQuery(); $vo = new DateTimeImmutable('2020-09-01 00:00:00'); @@ -295,14 +295,14 @@ public function testProcessParameterValueValueObjectWithDriverChain(): void public function testProcessParameterValueNull(): void { - $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.user = :user'); + $query = $this->entityManager->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsAddress a WHERE a.user = :user'); self::assertNull($query->processParameterValue(null)); } public function testDefaultQueryHints(): void { - $config = $this->_em->getConfiguration(); + $config = $this->entityManager->getConfiguration(); $defaultHints = [ 'hint_name_1' => 'hint_value_1', 'hint_name_2' => 'hint_value_2', @@ -310,9 +310,9 @@ public function testDefaultQueryHints(): void ]; $config->setDefaultQueryHints($defaultHints); - $query = $this->_em->createQuery(); + $query = $this->entityManager->createQuery(); $this->assertSame($config->getDefaultQueryHints(), $query->getHints()); - $this->_em->getConfiguration()->setDefaultQueryHint('hint_name_1', 'hint_another_value_1'); + $this->entityManager->getConfiguration()->setDefaultQueryHint('hint_name_1', 'hint_another_value_1'); $this->assertNotSame($config->getDefaultQueryHints(), $query->getHints()); $q2 = clone $query; $this->assertSame($config->getDefaultQueryHints(), $q2->getHints()); @@ -323,15 +323,15 @@ public function testDefaultQueryHints(): void */ public function testResultCacheCaching(): void { - $this->_em->getConfiguration()->setResultCacheImpl(new ArrayCache()); - $this->_em->getConfiguration()->setQueryCacheImpl(new ArrayCache()); - $driverConnectionMock = $this->_em->getConnection()->getWrappedConnection(); + $this->entityManager->getConfiguration()->setResultCacheImpl(new ArrayCache()); + $this->entityManager->getConfiguration()->setQueryCacheImpl(new ArrayCache()); + $driverConnectionMock = $this->entityManager->getConnection()->getWrappedConnection(); assert($driverConnectionMock instanceof DriverConnectionMock); $stmt = new StatementArrayMock([ ['id_0' => 1], ]); $driverConnectionMock->setStatementMock($stmt); - $res = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u') + $res = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u') ->useQueryCache(true) ->enableResultCache(60) //let it cache @@ -341,7 +341,7 @@ public function testResultCacheCaching(): void $driverConnectionMock->setStatementMock(null); - $res = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u') + $res = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u') ->useQueryCache(true) ->disableResultCache() ->getResult(); @@ -353,7 +353,7 @@ public function testResultCacheCaching(): void */ public function testSetHydrationCacheProfileNull(): void { - $query = $this->_em->createQuery(); + $query = $this->entityManager->createQuery(); $query->setHydrationCacheProfile(null); $this->assertNull($query->getHydrationCacheProfile()); } @@ -363,12 +363,12 @@ public function testSetHydrationCacheProfileNull(): void */ public function testResultCacheEviction(): void { - $this->_em->getConfiguration()->setResultCacheImpl(new ArrayCache()); + $this->entityManager->getConfiguration()->setResultCacheImpl(new ArrayCache()); - $query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u') + $query = $this->entityManager->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u') ->enableResultCache(); - $driverConnectionMock = $this->_em->getConnection() + $driverConnectionMock = $this->entityManager->getConnection() ->getWrappedConnection(); assert($driverConnectionMock instanceof DriverConnectionMock); @@ -396,7 +396,7 @@ public function testResultCacheEviction(): void */ public function testSelectJoinSubquery(): void { - $query = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u JOIN (SELECT )'); + $query = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u JOIN (SELECT )'); $this->expectException(QueryException::class); $this->expectExceptionMessage('Subquery'); @@ -408,7 +408,7 @@ public function testSelectJoinSubquery(): void */ public function testSelectFromSubquery(): void { - $query = $this->_em->createQuery('select u from (select Doctrine\Tests\Models\CMS\CmsUser c) as u'); + $query = $this->entityManager->createQuery('select u from (select Doctrine\Tests\Models\CMS\CmsUser c) as u'); $this->expectException(QueryException::class); $this->expectExceptionMessage('Subquery'); @@ -420,7 +420,7 @@ public function testSelectFromSubquery(): void */ public function testGetParameterTypeJuggling(): void { - $query = $this->_em->createQuery('select u from ' . CmsUser::class . ' u where u.id = ?0'); + $query = $this->entityManager->createQuery('select u from ' . CmsUser::class . ' u where u.id = ?0'); $query->setParameter(0, 0); @@ -434,7 +434,7 @@ public function testGetParameterTypeJuggling(): void */ public function testSetParameterWithNameZeroIsNotOverridden(): void { - $query = $this->_em->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); + $query = $this->entityManager->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); $query->setParameter(0, 0); $query->setParameter('name', 'Doctrine'); @@ -449,7 +449,7 @@ public function testSetParameterWithNameZeroIsNotOverridden(): void */ public function testSetParameterWithNameZeroDoesNotOverrideAnotherParameter(): void { - $query = $this->_em->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); + $query = $this->entityManager->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); $query->setParameter('name', 'Doctrine'); $query->setParameter(0, 0); @@ -464,7 +464,7 @@ public function testSetParameterWithNameZeroDoesNotOverrideAnotherParameter(): v */ public function testSetParameterWithTypeJugglingWorks(): void { - $query = $this->_em->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); + $query = $this->entityManager->createQuery('select u from ' . CmsUser::class . ' u where u.id != ?0 and u.username = :name'); $query->setParameter('0', 1); $query->setParameter('name', 'Doctrine'); @@ -482,9 +482,9 @@ public function testSetParameterWithTypeJugglingWorks(): void */ public function testResultCacheProfileCanBeRemovedViaSetter(): void { - $this->_em->getConfiguration()->setResultCacheImpl(new ArrayCache()); + $this->entityManager->getConfiguration()->setResultCacheImpl(new ArrayCache()); - $query = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u'); + $query = $this->entityManager->createQuery('SELECT u FROM ' . CmsUser::class . ' u'); $query->enableResultCache(); $query->setResultCacheProfile(); @@ -496,13 +496,13 @@ public function testValuesAreNotBeingResolvedForSpecifiedParameterTypes(): void { $unitOfWork = $this->createMock(UnitOfWork::class); - $this->_em->setUnitOfWork($unitOfWork); + $this->entityManager->setUnitOfWork($unitOfWork); $unitOfWork ->expects(self::never()) ->method('getSingleIdentifierValue'); - $query = $this->_em->createQuery('SELECT d FROM ' . DateTimeModel::class . ' d WHERE d.datetime = :value'); + $query = $this->entityManager->createQuery('SELECT d FROM ' . DateTimeModel::class . ' d WHERE d.datetime = :value'); $query->setParameter('value', new DateTime(), Type::DATETIME); @@ -515,7 +515,7 @@ public function testNonExistentExecutor(): void $this->expectException(QueryException::class); $this->expectExceptionMessage('[Syntax Error] line 0, col -1: Error: Expected SELECT, UPDATE or DELETE, got end of string.'); - $query = $this->_em->createQuery('0')->execute(); + $query = $this->entityManager->createQuery('0')->execute(); } /** @@ -523,7 +523,7 @@ public function testNonExistentExecutor(): void */ public function testGetParameterColonNormalize(): void { - $query = $this->_em->createQuery('select u from ' . CmsUser::class . ' u where u.name = :name'); + $query = $this->entityManager->createQuery('select u from ' . CmsUser::class . ' u where u.name = :name'); $query->setParameter(':name', 'Benjamin'); $query->setParameter('name', 'Benjamin'); diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index 82ff47f40ff..f532f52475e 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -33,11 +33,11 @@ class SelectSqlGenerationTest extends OrmTestCase { /** @var EntityManagerInterface */ - private $_em; + private $entityManager; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } /** @@ -53,7 +53,7 @@ public function assertSqlGeneration( array $queryParams = [] ): void { try { - $query = $this->_em->createQuery($dqlToBeTested); + $query = $this->entityManager->createQuery($dqlToBeTested); foreach ($queryParams as $name => $value) { $query->setParameter($name, $value); @@ -94,7 +94,7 @@ public function assertInvalidSqlGeneration( ): void { $this->expectException($expectedException); - $query = $this->_em->createQuery($dqlToBeTested); + $query = $this->entityManager->createQuery($dqlToBeTested); foreach ($queryParams as $name => $value) { $query->setParameter($name, $value); @@ -340,7 +340,7 @@ public function testSupportsAggregateFunctionWithSimpleArithmetic(): void */ public function testSupportsAggregateCountFunctionWithSimpleArithmetic(): void { - $connMock = $this->_em->getConnection(); + $connMock = $this->entityManager->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); $connMock->setDatabasePlatform(new MySqlPlatform()); @@ -461,7 +461,7 @@ public function testJoinOnClauseNotYetSupportedThrowsException(): void { $this->expectException(QueryException::class); - $sql = $this->_em->createQuery( + $sql = $this->entityManager->createQuery( "SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a ON a.topic LIKE '%foo%'" )->getSql(); } @@ -584,7 +584,7 @@ public function testSupportsInstanceOfExpressionsUsingInputParameterInWherePart( 'SELECT u FROM Doctrine\Tests\Models\Company\CompanyPerson u WHERE u INSTANCE OF ?1', 'SELECT c0_.id AS id_0, c0_.name AS name_1, c0_.discr AS discr_2 FROM company_persons c0_ WHERE c0_.discr IN (?)', [], - [1 => $this->_em->getClassMetadata(CompanyEmployee::class)] + [1 => $this->entityManager->getClassMetadata(CompanyEmployee::class)] ); } @@ -643,7 +643,7 @@ public function testInvalidInExpressionWithSingleValuedAssociationPathExpression public function testSupportsConcatFunctionForMysqlAndPostgresql(): void { - $connMock = $this->_em->getConnection(); + $connMock = $this->entityManager->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); $connMock->setDatabasePlatform(new MySqlPlatform()); @@ -691,7 +691,7 @@ public function testSubqueriesInComparisonExpression(): void public function testSupportsMemberOfExpressionOneToMany(): void { // "Get all users who have $phone as a phonenumber." (*cough* doesnt really make sense...) - $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers'); + $q = $this->entityManager->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $phone = new CmsPhonenumber(); @@ -707,7 +707,7 @@ public function testSupportsMemberOfExpressionOneToMany(): void public function testSupportsMemberOfExpressionManyToMany(): void { // "Get all users who are members of $group." - $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); + $q = $this->entityManager->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $group = new CmsGroup(); @@ -722,7 +722,7 @@ public function testSupportsMemberOfExpressionManyToMany(): void public function testSupportsMemberOfExpressionManyToManyParameterArray(): void { - $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); + $q = $this->entityManager->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.groups'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $group = new CmsGroup(); @@ -741,9 +741,9 @@ public function testSupportsMemberOfExpressionSelfReferencing(): void { // "Get all persons who have $person as a friend." // Tough one: Many-many self-referencing ("friends") with class table inheritance - $q = $this->_em->createQuery('SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p WHERE :param MEMBER OF p.friends'); + $q = $this->entityManager->createQuery('SELECT p FROM Doctrine\Tests\Models\Company\CompanyPerson p WHERE :param MEMBER OF p.friends'); $person = new CompanyPerson(); - $this->_em->getClassMetadata(get_class($person))->setIdentifierValues($person, ['id' => 101]); + $this->entityManager->getClassMetadata(get_class($person))->setIdentifierValues($person, ['id' => 101]); $q->setParameter('param', $person); $this->assertEquals( 'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.title AS title_2, c2_.salary AS salary_3, c2_.department AS department_4, c2_.startDate AS startDate_5, c0_.discr AS discr_6, c0_.spouse_id AS spouse_id_7, c1_.car_id AS car_id_8 FROM company_persons c0_ LEFT JOIN company_managers c1_ ON c0_.id = c1_.id LEFT JOIN company_employees c2_ ON c0_.id = c2_.id WHERE EXISTS (SELECT 1 FROM company_persons_friends c3_ INNER JOIN company_persons c4_ ON c3_.friend_id = c4_.id WHERE c3_.person_id = c0_.id AND c4_.id IN (?))', @@ -754,7 +754,7 @@ public function testSupportsMemberOfExpressionSelfReferencing(): void public function testSupportsMemberOfWithSingleValuedAssociation(): void { // Impossible example, but it illustrates the purpose - $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.email MEMBER OF u.groups'); + $q = $this->entityManager->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.email MEMBER OF u.groups'); $this->assertEquals( 'SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE EXISTS (SELECT 1 FROM cms_users_groups c1_ INNER JOIN cms_groups c2_ ON c1_.group_id = c2_.id WHERE c1_.user_id = c0_.id AND c2_.id IN (c0_.email_id))', @@ -765,7 +765,7 @@ public function testSupportsMemberOfWithSingleValuedAssociation(): void public function testSupportsMemberOfWithIdentificationVariable(): void { // Impossible example, but it illustrates the purpose - $q = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u MEMBER OF u.groups'); + $q = $this->entityManager->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u MEMBER OF u.groups'); $this->assertEquals( 'SELECT c0_.id AS id_0 FROM cms_users c0_ WHERE EXISTS (SELECT 1 FROM cms_users_groups c1_ INNER JOIN cms_groups c2_ ON c1_.group_id = c2_.id WHERE c1_.user_id = c0_.id AND c2_.id IN (c0_.id))', @@ -775,21 +775,21 @@ public function testSupportsMemberOfWithIdentificationVariable(): void public function testSupportsCurrentDateFunction(): void { - $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_date()'); + $q = $this->entityManager->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_date()'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_datetime > CURRENT_DATE', $q->getSql()); } public function testSupportsCurrentTimeFunction(): void { - $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.time > current_time()'); + $q = $this->entityManager->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.time > current_time()'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_time > CURRENT_TIME', $q->getSql()); } public function testSupportsCurrentTimestampFunction(): void { - $q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_timestamp()'); + $q = $this->entityManager->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_timestamp()'); $q->setHint(ORMQuery::HINT_FORCE_PARTIAL_LOAD, true); $this->assertEquals('SELECT d0_.id AS id_0 FROM date_time_model d0_ WHERE d0_.col_datetime > CURRENT_TIMESTAMP', $q->getSql()); } @@ -832,7 +832,7 @@ public function testExistsExpressionWithSimpleSelectReturningScalar(): void public function testLimitFromQueryClass(): void { - $q = $this->_em + $q = $this->entityManager ->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u') ->setMaxResults(10); @@ -841,7 +841,7 @@ public function testLimitFromQueryClass(): void public function testLimitAndOffsetFromQueryClass(): void { - $q = $this->_em + $q = $this->entityManager ->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u') ->setMaxResults(10) ->setFirstResult(0); @@ -927,14 +927,14 @@ public function testOrderBySupportsSingleValuedPathExpressionOwningSide(): void public function testOrderBySupportsSingleValuedPathExpressionInverseSide(): void { $this->expectException('\Doctrine\ORM\Query\QueryException'); - $q = $this->_em->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u order by u.address'); + $q = $this->entityManager->createQuery('select u from Doctrine\Tests\Models\CMS\CmsUser u order by u.address'); $q->getSQL(); } public function testBooleanLiteralInWhereOnSqlite(): void { - $oldPlat = $this->_em->getConnection()->getDatabasePlatform(); - $this->_em->getConnection()->setDatabasePlatform(new SqlitePlatform()); + $oldPlat = $this->entityManager->getConnection()->getDatabasePlatform(); + $this->entityManager->getConnection()->setDatabasePlatform(new SqlitePlatform()); $this->assertSqlGeneration( 'SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true', @@ -946,13 +946,13 @@ public function testBooleanLiteralInWhereOnSqlite(): void 'SELECT b0_.id AS id_0, b0_.booleanField AS booleanField_1 FROM boolean_model b0_ WHERE b0_.booleanField = 0' ); - $this->_em->getConnection()->setDatabasePlatform($oldPlat); + $this->entityManager->getConnection()->setDatabasePlatform($oldPlat); } public function testBooleanLiteralInWhereOnPostgres(): void { - $oldPlat = $this->_em->getConnection()->getDatabasePlatform(); - $this->_em->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); + $oldPlat = $this->entityManager->getConnection()->getDatabasePlatform(); + $this->entityManager->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( 'SELECT b FROM Doctrine\Tests\Models\Generic\BooleanModel b WHERE b.booleanField = true', @@ -964,7 +964,7 @@ public function testBooleanLiteralInWhereOnPostgres(): void 'SELECT b0_.id AS id_0, b0_.booleanField AS booleanfield_1 FROM boolean_model b0_ WHERE b0_.booleanField = false' ); - $this->_em->getConnection()->setDatabasePlatform($oldPlat); + $this->entityManager->getConnection()->setDatabasePlatform($oldPlat); } public function testSingleValuedAssociationFieldInWhere(): void @@ -1076,7 +1076,7 @@ public function testSubselectInSelect(): void */ public function testPessimisticWriteLockQueryHint(): void { - if ($this->_em->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) { + if ($this->entityManager->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) { $this->markTestSkipped('SqLite does not support Row locking at all.'); } @@ -1094,7 +1094,7 @@ public function testPessimisticWriteLockQueryHint(): void */ public function testPessimisticReadLockQueryHintPostgreSql(): void { - $this->_em->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); + $this->entityManager->getConnection()->setDatabasePlatform(new PostgreSqlPlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", @@ -1135,7 +1135,7 @@ public function testSupportSelectWithMoreThan10InputParameters(): void */ public function testPessimisticReadLockQueryHintMySql(): void { - $this->_em->getConnection()->setDatabasePlatform(new MySqlPlatform()); + $this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", @@ -1151,7 +1151,7 @@ public function testPessimisticReadLockQueryHintMySql(): void */ public function testPessimisticReadLockQueryHintOracle(): void { - $this->_em->getConnection()->setDatabasePlatform(new OraclePlatform()); + $this->entityManager->getConnection()->setDatabasePlatform(new OraclePlatform()); $this->assertSqlGeneration( "SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = 'gblanco'", @@ -1166,7 +1166,7 @@ public function testPessimisticReadLockQueryHintOracle(): void */ public function testSupportToCustomDQLFunctions(): void { - $config = $this->_em->getConfiguration(); + $config = $this->entityManager->getConfiguration(); $config->addCustomNumericFunction('MYABS', MyAbsFunction::class); $this->assertSqlGeneration( @@ -1241,7 +1241,7 @@ public function testIdVariableResultVariableReuse(): void { $exceptionThrown = false; try { - $query = $this->_em->createQuery('SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN (SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u)'); + $query = $this->entityManager->createQuery('SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IN (SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u)'); $query->getSql(); $query->free(); @@ -2101,7 +2101,7 @@ public function testCaseThenFunction(): void */ public function testSupportsMoreThanTwoParametersInConcatFunction(): void { - $connMock = $this->_em->getConnection(); + $connMock = $this->entityManager->getConnection(); $orgPlatform = $connMock->getDatabasePlatform(); $connMock->setDatabasePlatform(new MySqlPlatform()); diff --git a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php index a6537d32d74..193de786abb 100644 --- a/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Query; use Doctrine\DBAL\Types\Type as DBALType; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\Tests\DbalTypes\NegativeToPositiveType; use Doctrine\Tests\OrmTestCase; use Exception; @@ -20,7 +21,8 @@ */ class UpdateSqlGenerationTest extends OrmTestCase { - private $_em; + /** @var EntityManagerInterface */ + private $entityManager; protected function setUp(): void { @@ -30,13 +32,13 @@ protected function setUp(): void DBALType::addType('negative_to_positive', NegativeToPositiveType::class); } - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void { try { - $query = $this->_em->createQuery($dqlToBeTested); + $query = $this->entityManager->createQuery($dqlToBeTested); parent::assertEquals($sqlToBeConfirmed, $query->getSql()); $query->free(); } catch (Exception $e) { diff --git a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php index 3622afcf7ab..247349d9562 100644 --- a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php @@ -30,11 +30,11 @@ class QueryBuilderTest extends OrmTestCase { /** @var EntityManager */ - private $_em; + private $entityManager; protected function setUp(): void { - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } protected function assertValidQueryBuilder(QueryBuilder $qb, $expectedDql): void @@ -47,7 +47,7 @@ protected function assertValidQueryBuilder(QueryBuilder $qb, $expectedDql): void public function testSelectSetsType(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->delete(CmsUser::class, 'u') ->select('u.id', 'u.username'); @@ -56,7 +56,7 @@ public function testSelectSetsType(): void public function testEmptySelectSetsType(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->delete(CmsUser::class, 'u') ->select(); @@ -65,7 +65,7 @@ public function testEmptySelectSetsType(): void public function testDeleteSetsType(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->from(CmsUser::class, 'u') ->delete(); @@ -74,7 +74,7 @@ public function testDeleteSetsType(): void public function testUpdateSetsType(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->from(CmsUser::class, 'u') ->update(); @@ -83,7 +83,7 @@ public function testUpdateSetsType(): void public function testSimpleSelect(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->from(CmsUser::class, 'u') ->select('u.id', 'u.username'); @@ -92,7 +92,7 @@ public function testSimpleSelect(): void public function testSimpleDelete(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->delete(CmsUser::class, 'u'); $this->assertValidQueryBuilder($qb, 'DELETE Doctrine\Tests\Models\CMS\CmsUser u'); @@ -100,7 +100,7 @@ public function testSimpleDelete(): void public function testSimpleSelectWithFromIndexBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->from(CmsUser::class, 'u', 'u.id') ->select('u.id', 'u.username'); @@ -109,7 +109,7 @@ public function testSimpleSelectWithFromIndexBy(): void public function testSimpleSelectWithIndexBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->from(CmsUser::class, 'u') ->indexBy('u', 'u.id') ->select('u.id', 'u.username'); @@ -119,7 +119,7 @@ public function testSimpleSelectWithIndexBy(): void public function testSimpleUpdate(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->update(CmsUser::class, 'u') ->set('u.username', ':username'); @@ -128,7 +128,7 @@ public function testSimpleUpdate(): void public function testInnerJoin(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'a') ->from(CmsUser::class, 'u') ->innerJoin('u.articles', 'a'); @@ -138,7 +138,7 @@ public function testInnerJoin(): void public function testComplexInnerJoin(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'a') ->from(CmsUser::class, 'u') ->innerJoin('u.articles', 'a', 'ON', 'u.id = a.author_id'); @@ -151,7 +151,7 @@ public function testComplexInnerJoin(): void public function testComplexInnerJoinWithIndexBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'a') ->from(CmsUser::class, 'u') ->innerJoin('u.articles', 'a', 'ON', 'u.id = a.author_id', 'a.name'); @@ -164,7 +164,7 @@ public function testComplexInnerJoinWithIndexBy(): void public function testLeftJoin(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'a') ->from(CmsUser::class, 'u') ->leftJoin('u.articles', 'a'); @@ -174,7 +174,7 @@ public function testLeftJoin(): void public function testLeftJoinWithIndexBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'a') ->from(CmsUser::class, 'u') ->leftJoin('u.articles', 'a', null, null, 'a.name'); @@ -184,7 +184,7 @@ public function testLeftJoinWithIndexBy(): void public function testMultipleFrom(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'g') ->from(CmsUser::class, 'u') ->from(CmsGroup::class, 'g'); @@ -194,7 +194,7 @@ public function testMultipleFrom(): void public function testMultipleFromWithIndexBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'g') ->from(CmsUser::class, 'u') ->from(CmsGroup::class, 'g') @@ -205,7 +205,7 @@ public function testMultipleFromWithIndexBy(): void public function testMultipleFromWithJoin(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'g') ->from(CmsUser::class, 'u') ->from(CmsGroup::class, 'g') @@ -216,7 +216,7 @@ public function testMultipleFromWithJoin(): void public function testMultipleFromWithMultipleJoin(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u', 'g') ->from(CmsUser::class, 'u') ->from(CmsArticle::class, 'a') @@ -229,7 +229,7 @@ public function testMultipleFromWithMultipleJoin(): void public function testWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid'); @@ -239,7 +239,7 @@ public function testWhere(): void public function testComplexAndWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid OR u.id = :uid2 OR u.id = :uid3') @@ -250,7 +250,7 @@ public function testComplexAndWhere(): void public function testAndWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -261,7 +261,7 @@ public function testAndWhere(): void public function testOrWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -272,7 +272,7 @@ public function testOrWhere(): void public function testComplexAndWhereOrWhereNesting(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -286,7 +286,7 @@ public function testComplexAndWhereOrWhereNesting(): void public function testAndWhereIn(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -297,7 +297,7 @@ public function testAndWhereIn(): void public function testOrWhereIn(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -308,7 +308,7 @@ public function testOrWhereIn(): void public function testAndWhereNotIn(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -319,7 +319,7 @@ public function testAndWhereNotIn(): void public function testOrWhereNotIn(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid') @@ -330,7 +330,7 @@ public function testOrWhereNotIn(): void public function testGroupBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->groupBy('u.id') @@ -341,7 +341,7 @@ public function testGroupBy(): void public function testHaving(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->groupBy('u.id') @@ -352,7 +352,7 @@ public function testHaving(): void public function testAndHaving(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->groupBy('u.id') @@ -364,7 +364,7 @@ public function testAndHaving(): void public function testOrHaving(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->groupBy('u.id') @@ -377,7 +377,7 @@ public function testOrHaving(): void public function testOrderBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->orderBy('u.username', 'ASC'); @@ -387,7 +387,7 @@ public function testOrderBy(): void public function testOrderByWithExpression(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->orderBy($qb->expr()->asc('u.username')); @@ -397,7 +397,7 @@ public function testOrderByWithExpression(): void public function testAddOrderBy(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->orderBy('u.username', 'ASC') @@ -408,7 +408,7 @@ public function testAddOrderBy(): void public function testAddOrderByWithExpression(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->orderBy('u.username', 'ASC') @@ -419,7 +419,7 @@ public function testAddOrderByWithExpression(): void public function testAddCriteriaWhere(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u'); @@ -434,7 +434,7 @@ public function testAddCriteriaWhere(): void public function testAddMultipleSameCriteriaWhere(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $criteria = new Criteria(); @@ -455,7 +455,7 @@ public function testAddMultipleSameCriteriaWhere(): void */ public function testAddCriteriaWhereWithMultipleParametersWithSameField(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $criteria = new Criteria(); @@ -474,7 +474,7 @@ public function testAddCriteriaWhereWithMultipleParametersWithSameField(): void */ public function testAddCriteriaWhereWithMultipleParametersWithDifferentFields(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $criteria = new Criteria(); @@ -493,7 +493,7 @@ public function testAddCriteriaWhereWithMultipleParametersWithDifferentFields(): */ public function testAddCriteriaWhereWithMultipleParametersWithSubpathsAndDifferentProperties(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $criteria = new Criteria(); @@ -512,7 +512,7 @@ public function testAddCriteriaWhereWithMultipleParametersWithSubpathsAndDiffere */ public function testAddCriteriaWhereWithMultipleParametersWithSubpathsAndSameProperty(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $criteria = new Criteria(); @@ -528,7 +528,7 @@ public function testAddCriteriaWhereWithMultipleParametersWithSubpathsAndSamePro public function testAddCriteriaOrder(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u'); @@ -546,7 +546,7 @@ public function testAddCriteriaOrder(): void */ public function testAddCriteriaOrderOnJoinAlias(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->join('u.article', 'a'); @@ -562,7 +562,7 @@ public function testAddCriteriaOrderOnJoinAlias(): void public function testAddCriteriaLimit(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u'); @@ -578,7 +578,7 @@ public function testAddCriteriaLimit(): void public function testAddCriteriaUndefinedLimit(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->setFirstResult(2) @@ -594,7 +594,7 @@ public function testAddCriteriaUndefinedLimit(): void public function testGetQuery(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u'); $q = $qb->getQuery(); @@ -604,7 +604,7 @@ public function testGetQuery(): void public function testSetParameter(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :id') @@ -620,7 +620,7 @@ public function testSetParameter(): void public function testSetParameters(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where($qb->expr()->orX('u.username = :username', 'u.username = :username2')); @@ -636,7 +636,7 @@ public function testSetParameters(): void public function testGetParameters(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :id'); @@ -651,7 +651,7 @@ public function testGetParameters(): void public function testGetParameter(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :id'); @@ -666,7 +666,7 @@ public function testGetParameter(): void public function testMultipleWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = :uid', 'u.id = :uid2'); @@ -676,7 +676,7 @@ public function testMultipleWhere(): void public function testMultipleAndWhere(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->andWhere('u.id = :uid', 'u.id = :uid2'); @@ -686,7 +686,7 @@ public function testMultipleAndWhere(): void public function testMultipleOrWhere(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->orWhere('u.id = :uid', $qb->expr()->eq('u.id', ':uid2')); @@ -696,7 +696,7 @@ public function testMultipleOrWhere(): void public function testComplexWhere(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $orExpr = $qb->expr()->orX(); $orExpr->add($qb->expr()->eq('u.id', ':uid3')); $orExpr->add($qb->expr()->in('u.id', [1])); @@ -710,7 +710,7 @@ public function testComplexWhere(): void public function testWhereInWithStringLiterals(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where($qb->expr()->in('u.name', ['one', 'two', 'three'])); @@ -724,8 +724,8 @@ public function testWhereInWithStringLiterals(): void public function testWhereInWithObjectLiterals(): void { - $qb = $this->_em->createQueryBuilder(); - $expr = $this->_em->getExpressionBuilder(); + $qb = $this->entityManager->createQueryBuilder(); + $expr = $this->entityManager->getExpressionBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where($expr->in('u.name', [$expr->literal('one'), $expr->literal('two'), $expr->literal('three')])); @@ -739,12 +739,12 @@ public function testWhereInWithObjectLiterals(): void public function testNegation(): void { - $expr = $this->_em->getExpressionBuilder(); + $expr = $this->entityManager->getExpressionBuilder(); $orExpr = $expr->orX(); $orExpr->add($expr->eq('u.id', ':uid3')); $orExpr->add($expr->not($expr->in('u.id', [1]))); - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') ->where($orExpr); @@ -754,8 +754,8 @@ public function testNegation(): void public function testSomeAllAny(): void { - $qb = $this->_em->createQueryBuilder(); - $expr = $this->_em->getExpressionBuilder(); + $qb = $this->entityManager->createQueryBuilder(); + $expr = $this->entityManager->getExpressionBuilder(); $qb->select('u') ->from(CmsUser::class, 'u') @@ -766,8 +766,8 @@ public function testSomeAllAny(): void public function testMultipleIsolatedQueryConstruction(): void { - $qb = $this->_em->createQueryBuilder(); - $expr = $this->_em->getExpressionBuilder(); + $qb = $this->entityManager->createQueryBuilder(); + $expr = $this->entityManager->getExpressionBuilder(); $qb->select('u')->from(CmsUser::class, 'u'); $qb->where($expr->eq('u.name', ':name')); @@ -792,19 +792,19 @@ public function testMultipleIsolatedQueryConstruction(): void public function testGetEntityManager(): void { - $qb = $this->_em->createQueryBuilder(); - $this->assertEquals($this->_em, $qb->getEntityManager()); + $qb = $this->entityManager->createQueryBuilder(); + $this->assertEquals($this->entityManager, $qb->getEntityManager()); } public function testInitialStateIsClean(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $this->assertEquals(QueryBuilder::STATE_CLEAN, $qb->getState()); } public function testAlteringQueryChangesStateToDirty(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u'); @@ -813,7 +813,7 @@ public function testAlteringQueryChangesStateToDirty(): void public function testSelectWithFuncExpression(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $expr = $qb->expr(); $qb->select($expr->count('e.id')); @@ -822,7 +822,7 @@ public function testSelectWithFuncExpression(): void public function testResetDQLPart(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.username = ?1')->orderBy('u.username'); @@ -838,7 +838,7 @@ public function testResetDQLPart(): void public function testResetDQLParts(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.username = ?1')->orderBy('u.username'); @@ -852,7 +852,7 @@ public function testResetDQLParts(): void public function testResetAllDQLParts(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.username = ?1')->orderBy('u.username'); @@ -869,7 +869,7 @@ public function testResetAllDQLParts(): void */ public function testDeepClone(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->andWhere('u.username = ?1') @@ -889,7 +889,7 @@ public function testDeepClone(): void */ public function testAddCriteriaWhereWithJoinAlias(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $qb->join('alias1.articles', 'alias2'); @@ -909,7 +909,7 @@ public function testAddCriteriaWhereWithJoinAlias(): void */ public function testAddCriteriaWhereWithDefaultAndJoinAlias(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $qb->join('alias1.articles', 'alias2'); @@ -929,7 +929,7 @@ public function testAddCriteriaWhereWithDefaultAndJoinAlias(): void */ public function testAddCriteriaWhereOnJoinAliasWithDuplicateFields(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('alias1')->from(CmsUser::class, 'alias1'); $qb->join('alias1.articles', 'alias2'); @@ -951,7 +951,7 @@ public function testAddCriteriaWhereOnJoinAliasWithDuplicateFields(): void */ public function testParametersAreCloned(): void { - $originalQb = new QueryBuilder($this->_em); + $originalQb = new QueryBuilder($this->entityManager); $originalQb->setParameter('parameter1', 'value1'); @@ -965,7 +965,7 @@ public function testParametersAreCloned(): void public function testGetRootAlias(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u'); @@ -974,7 +974,7 @@ public function testGetRootAlias(): void public function testGetRootAliases(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u'); @@ -983,7 +983,7 @@ public function testGetRootAliases(): void public function testGetRootEntities(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u'); @@ -992,7 +992,7 @@ public function testGetRootEntities(): void public function testGetSeveralRootAliases(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->from(CmsUser::class, 'u2'); @@ -1003,7 +1003,7 @@ public function testGetSeveralRootAliases(): void public function testBCAddJoinWithoutRootAlias(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->add('join', ['INNER JOIN u.groups g'], true); @@ -1016,8 +1016,8 @@ public function testBCAddJoinWithoutRootAlias(): void */ public function testEmptyStringLiteral(): void { - $expr = $this->_em->getExpressionBuilder(); - $qb = $this->_em->createQueryBuilder() + $expr = $this->entityManager->getExpressionBuilder(); + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where($expr->eq('u.username', $expr->literal(''))); @@ -1030,8 +1030,8 @@ public function testEmptyStringLiteral(): void */ public function testEmptyNumericLiteral(): void { - $expr = $this->_em->getExpressionBuilder(); - $qb = $this->_em->createQueryBuilder() + $expr = $this->entityManager->getExpressionBuilder(); + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where($expr->eq('u.username', $expr->literal(0))); @@ -1044,7 +1044,7 @@ public function testEmptyNumericLiteral(): void */ public function testAddFromString(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->add('select', 'u') ->add('from', CmsUser::class . ' u'); @@ -1056,7 +1056,7 @@ public function testAddFromString(): void */ public function testAddDistinct(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->distinct() ->from(CmsUser::class, 'u'); @@ -1072,14 +1072,14 @@ public function testWhereAppend(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Using \$append = true does not have an effect with 'where' or 'having' parts. See QueryBuilder#andWhere() for an example for correct usage."); - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->add('where', 'u.foo = ?1') ->add('where', 'u.bar = ?2', true); } public function testSecondLevelCacheQueryBuilderOptions(): void { - $defaultQueryBuilder = $this->_em->createQueryBuilder() + $defaultQueryBuilder = $this->entityManager->createQueryBuilder() ->select('s') ->from(State::class, 's'); @@ -1095,7 +1095,7 @@ public function testSecondLevelCacheQueryBuilderOptions(): void $this->assertNull($defaultQuery->getCacheRegion()); $this->assertNull($defaultQuery->getCacheMode()); - $builder = $this->_em->createQueryBuilder() + $builder = $this->entityManager->createQueryBuilder() ->select('s') ->setLifetime(123) ->setCacheable(true) @@ -1121,7 +1121,7 @@ public function testSecondLevelCacheQueryBuilderOptions(): void */ public function testRebuildsFromParts(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->join('u.article', 'a'); @@ -1129,7 +1129,7 @@ public function testRebuildsFromParts(): void $dqlParts = $qb->getDQLParts(); $dql = $qb->getDQL(); - $qb2 = $this->_em->createQueryBuilder(); + $qb2 = $this->entityManager->createQueryBuilder(); foreach (array_filter($dqlParts) as $name => $part) { $qb2->add($name, $part); } @@ -1141,7 +1141,7 @@ public function testRebuildsFromParts(): void public function testGetAllAliasesWithNoJoins(): void { - $qb = $this->_em->createQueryBuilder(); + $qb = $this->entityManager->createQueryBuilder(); $qb->select('u')->from(CmsUser::class, 'u'); $aliases = $qb->getAllAliases(); @@ -1151,7 +1151,7 @@ public function testGetAllAliasesWithNoJoins(): void public function testGetAllAliasesWithJoins(): void { - $qb = $this->_em->createQueryBuilder() + $qb = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->join('u.groups', 'g'); @@ -1166,7 +1166,7 @@ public function testGetAllAliasesWithJoins(): void */ public function testGetParameterTypeJuggling(): void { - $builder = $this->_em->createQueryBuilder() + $builder = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id = ?0'); @@ -1183,7 +1183,7 @@ public function testGetParameterTypeJuggling(): void */ public function testSetParameterWithNameZeroIsNotOverridden(): void { - $builder = $this->_em->createQueryBuilder() + $builder = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id != ?0') @@ -1202,7 +1202,7 @@ public function testSetParameterWithNameZeroIsNotOverridden(): void */ public function testSetParameterWithNameZeroDoesNotOverrideAnotherParameter(): void { - $builder = $this->_em->createQueryBuilder() + $builder = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id != ?0') @@ -1221,7 +1221,7 @@ public function testSetParameterWithNameZeroDoesNotOverrideAnotherParameter(): v */ public function testSetParameterWithTypeJugglingWorks(): void { - $builder = $this->_em->createQueryBuilder() + $builder = $this->entityManager->createQueryBuilder() ->select('u') ->from(CmsUser::class, 'u') ->where('u.id != ?0') diff --git a/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php index a3207a791db..493d353846d 100644 --- a/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/AttachEntityListenersListenerTest.php @@ -115,6 +115,7 @@ public function testDuplicateEntityListenerException(): void class AttachEntityListenersListenerTestFooEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -129,6 +130,7 @@ class AttachEntityListenersListenerTestFooEntity class AttachEntityListenersListenerTestBarEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -138,6 +140,7 @@ class AttachEntityListenersListenerTestBarEntity class AttachEntityListenersListenerTestListener { + /** @psalm-var array>> */ public $calls; public function prePersist(): void @@ -158,6 +161,7 @@ public function postPersist(): void class AttachEntityListenersListenerTestListener2 { + /** @psalm-var array>> */ public $calls; public function prePersist(): void diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php index 14ccabb66ab..918ddf671c0 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/Command/GenerateRepositoriesCommandTest.php @@ -40,6 +40,7 @@ class GenerateRepositoriesCommandTest extends OrmFunctionalTestCase /** @var Application */ private $application; + /** @var string */ private $path; protected function setUp(): void diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php index c5d4997662a..fec808118be 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/MetadataFilterTest.php @@ -148,6 +148,7 @@ public function testFilterWithRegex(): void class MetadataFilterTestEntityAaa { /** + * @var int * @Id * @Column */ @@ -158,6 +159,7 @@ class MetadataFilterTestEntityAaa class MetadataFilterTestEntityBbb { /** + * @var int * @Id * @Column */ @@ -168,6 +170,7 @@ class MetadataFilterTestEntityBbb class MetadataFilterTestEntityCcc { /** + * @var int * @Id * @Column */ @@ -178,6 +181,7 @@ class MetadataFilterTestEntityCcc class MetadataFilterTestEntityFoo { /** + * @var int * @Id * @Column */ @@ -188,6 +192,7 @@ class MetadataFilterTestEntityFoo class MetadataFilterTestEntityBar { /** + * @var int * @Id * @Column */ @@ -198,6 +203,7 @@ class MetadataFilterTestEntityBar class MetadataFilterTestEntityFooBar { /** + * @var int * @Id * @Column */ diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php index fe6645b7b8b..dae2a8f784b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php @@ -52,27 +52,31 @@ class EntityGeneratorTest extends OrmTestCase use VerifyDeprecations; /** @var EntityGenerator */ - private $_generator; - private $_tmpDir; - private $_namespace; + private $generator; + + /** @var string */ + private $tmpDir; + + /** @var string */ + private $namespace; protected function setUp(): void { - $this->_namespace = uniqid('doctrine_'); - $this->_tmpDir = sys_get_temp_dir(); - mkdir($this->_tmpDir . DIRECTORY_SEPARATOR . $this->_namespace); - $this->_generator = new EntityGenerator(); - $this->_generator->setAnnotationPrefix(''); - $this->_generator->setGenerateAnnotations(true); - $this->_generator->setGenerateStubMethods(true); - $this->_generator->setRegenerateEntityIfExists(false); - $this->_generator->setUpdateEntityIfExists(true); - $this->_generator->setFieldVisibility(EntityGenerator::FIELD_VISIBLE_PROTECTED); + $this->namespace = uniqid('doctrine_'); + $this->tmpDir = sys_get_temp_dir(); + mkdir($this->tmpDir . DIRECTORY_SEPARATOR . $this->namespace); + $this->generator = new EntityGenerator(); + $this->generator->setAnnotationPrefix(''); + $this->generator->setGenerateAnnotations(true); + $this->generator->setGenerateStubMethods(true); + $this->generator->setRegenerateEntityIfExists(false); + $this->generator->setUpdateEntityIfExists(true); + $this->generator->setFieldVisibility(EntityGenerator::FIELD_VISIBLE_PROTECTED); } public function tearDown(): void { - $ri = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->_tmpDir . '/' . $this->_namespace)); + $ri = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->tmpDir . '/' . $this->namespace)); foreach ($ri as $file) { assert($file instanceof SplFileInfo); if ($file->isFile()) { @@ -80,7 +84,7 @@ public function tearDown(): void } } - rmdir($this->_tmpDir . '/' . $this->_namespace); + rmdir($this->tmpDir . '/' . $this->namespace); } /** @after */ @@ -94,9 +98,9 @@ public function ensureTestGeneratedDeprecationMessages(): void */ public function generateBookEntityFixture(array $embeddedClasses = []): ClassMetadataInfo { - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); - $metadata->namespace = $this->_namespace; - $metadata->customRepositoryClassName = $this->_namespace . '\EntityGeneratorBookRepository'; + $metadata = new ClassMetadataInfo($this->namespace . '\EntityGeneratorBook'); + $metadata->namespace = $this->namespace; + $metadata->customRepositoryClassName = $this->namespace . '\EntityGeneratorBookRepository'; $metadata->table['name'] = 'book'; $metadata->table['uniqueConstraints']['name_uniq'] = ['columns' => ['name']]; @@ -131,15 +135,15 @@ public function generateBookEntityFixture(array $embeddedClasses = []): ClassMet $this->mapEmbedded($fieldName, $metadata, $embeddedClass); } - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); return $metadata; } - private function generateEntityTypeFixture(array $field) + private function generateEntityTypeFixture(array $field): ClassMetadataInfo { - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityType'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\EntityType'); + $metadata->namespace = $this->namespace; $metadata->table['name'] = 'entity_type'; $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); @@ -149,15 +153,15 @@ private function generateEntityTypeFixture(array $field) $type = $field['dbType']; $metadata->mapField(['fieldName' => $name, 'type' => $type]); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); return $metadata; } private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null): ClassMetadataInfo { - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorIsbn'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\EntityGeneratorIsbn'); + $metadata->namespace = $this->namespace; $metadata->isEmbeddedClass = true; $metadata->mapField(['fieldName' => 'prefix', 'type' => 'integer']); $metadata->mapField(['fieldName' => 'groupNumber', 'type' => 'integer']); @@ -169,22 +173,22 @@ private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $col $this->mapEmbedded($fieldName, $metadata, $embeddedClass, $columnPrefix); } - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); return $metadata; } private function generateTestEmbeddableFixture(): ClassMetadataInfo { - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorTestEmbeddable'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\EntityGeneratorTestEmbeddable'); + $metadata->namespace = $this->namespace; $metadata->isEmbeddedClass = true; $metadata->mapField(['fieldName' => 'field1', 'type' => 'integer']); $metadata->mapField(['fieldName' => 'field2', 'type' => 'integer', 'nullable' => true]); $metadata->mapField(['fieldName' => 'field3', 'type' => 'datetime']); $metadata->mapField(['fieldName' => 'field4', 'type' => 'datetime', 'nullable' => true]); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); return $metadata; } @@ -226,7 +230,7 @@ private function mapNestedEmbedded( private function loadEntityClass(ClassMetadataInfo $metadata): void { $className = basename(str_replace('\\', '/', $metadata->name)); - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; + $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; $this->assertFileExists($path); @@ -347,9 +351,9 @@ public function testBooleanDefaultValue(): void $testEmbeddableMetadata = $this->generateTestEmbeddableFixture(); $this->mapEmbedded('testEmbedded', $metadata, $testEmbeddableMetadata); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/EntityGeneratorBook.php~'); + $this->assertFileExists($this->tmpDir . '/' . $this->namespace . '/EntityGeneratorBook.php~'); $book = $this->newInstance($metadata); $reflClass = new ReflectionClass($metadata->name); @@ -366,9 +370,9 @@ public function testEntityUpdatingWorks(): void $testEmbeddableMetadata = $this->generateTestEmbeddableFixture(); $this->mapEmbedded('testEmbedded', $metadata, $testEmbeddableMetadata); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/EntityGeneratorBook.php~'); + $this->assertFileExists($this->tmpDir . '/' . $this->namespace . '/EntityGeneratorBook.php~'); $book = $this->newInstance($metadata); $reflClass = new ReflectionClass($metadata->name); @@ -411,9 +415,9 @@ public function testDoesNotRegenerateExistingMethodsWithDifferentCase(): void unset($metadata->embeddedClasses['isbn']); // Should not throw a PHP fatal error - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/EntityGeneratorBook.php~'); + $this->assertFileExists($this->tmpDir . '/' . $this->namespace . '/EntityGeneratorBook.php~'); $this->newInstance($metadata); $reflClass = new ReflectionClass($metadata->name); @@ -456,7 +460,7 @@ public function testMethodDocBlockShouldStartWithBackSlash(): void public function testEntityExtendsStdClass(): void { - $this->_generator->setClassToExtend('stdClass'); + $this->generator->setClassToExtend('stdClass'); $metadata = $this->generateBookEntityFixture(); $book = $this->newInstance($metadata); @@ -518,7 +522,7 @@ public function testLoadMetadata(): void public function testLoadPrefixedMetadata(): void { - $this->_generator->setAnnotationPrefix('ORM\\'); + $this->generator->setAnnotationPrefix('ORM\\'); $embeddedMetadata = $this->generateIsbnEmbeddableFixture(); $metadata = $this->generateBookEntityFixture(['isbn' => $embeddedMetadata]); @@ -558,12 +562,12 @@ public function testLoadPrefixedMetadata(): void */ public function testMappedSuperclassAnnotationGeneration(): void { - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\EntityGeneratorBook'); + $metadata->namespace = $this->namespace; $metadata->isMappedSuperclass = true; - $this->_generator->setAnnotationPrefix('ORM\\'); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->setAnnotationPrefix('ORM\\'); + $this->generator->writeEntityClass($metadata, $this->tmpDir); $this->newInstance($metadata); // force instantiation (causes autoloading to kick in) $driver = new AnnotationDriver(new AnnotationReader(), []); @@ -580,15 +584,15 @@ public function testMappedSuperclassAnnotationGeneration(): void */ public function testParseTokensInEntityFile($php, $classes): void { - $r = new ReflectionObject($this->_generator); + $r = new ReflectionObject($this->generator); $m = $r->getMethod('parseTokensInEntityFile'); $m->setAccessible(true); $p = $r->getProperty('staticReflection'); $p->setAccessible(true); - $ret = $m->invoke($this->_generator, $php); - $this->assertEquals($classes, array_keys($p->getValue($this->_generator))); + $ret = $m->invoke($this->generator, $php); + $this->assertEquals($classes, array_keys($p->getValue($this->generator))); } /** @@ -596,8 +600,8 @@ public function testParseTokensInEntityFile($php, $classes): void */ public function testGenerateEntityWithSequenceGenerator(): void { - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC1784Entity'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\DDC1784Entity'); + $metadata->namespace = $this->namespace; $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); $metadata->setSequenceGeneratorDefinition( @@ -607,10 +611,10 @@ public function testGenerateEntityWithSequenceGenerator(): void 'initialValue' => 2, ] ); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; + $filename = $this->tmpDir . DIRECTORY_SEPARATOR + . $this->namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; $this->assertFileExists($filename); require_once $filename; @@ -632,8 +636,8 @@ public function testGenerateEntityWithSequenceGenerator(): void */ public function testGenerateEntityWithMultipleInverseJoinColumns(): void { - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC2079Entity'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\DDC2079Entity'); + $metadata->namespace = $this->namespace; $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); $metadata->mapManyToMany( @@ -653,10 +657,10 @@ public function testGenerateEntityWithMultipleInverseJoinColumns(): void ], ] ); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; + $filename = $this->tmpDir . DIRECTORY_SEPARATOR + . $this->namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; $this->assertFileExists($filename); require_once $filename; @@ -690,7 +694,7 @@ public function testGenerateEntityWithMultipleInverseJoinColumns(): void public function testGetInheritanceTypeString(): void { $reflection = new ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadataInfo'); - $method = new ReflectionMethod($this->_generator, 'getInheritanceTypeString'); + $method = new ReflectionMethod($this->generator, 'getInheritanceTypeString'); $constants = $reflection->getConstants(); $pattern = '/^INHERITANCE_TYPE_/'; @@ -702,7 +706,7 @@ public function testGetInheritanceTypeString(): void } $expected = preg_replace($pattern, '', $name); - $actual = $method->invoke($this->_generator, $value); + $actual = $method->invoke($this->generator, $value); $this->assertEquals($expected, $actual); } @@ -710,7 +714,7 @@ public function testGetInheritanceTypeString(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid provided InheritanceType: INVALID'); - $method->invoke($this->_generator, 'INVALID'); + $method->invoke($this->generator, 'INVALID'); } /** @@ -719,7 +723,7 @@ public function testGetInheritanceTypeString(): void public function testGetChangeTrackingPolicyString(): void { $reflection = new ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata'); - $method = new ReflectionMethod($this->_generator, 'getChangeTrackingPolicyString'); + $method = new ReflectionMethod($this->generator, 'getChangeTrackingPolicyString'); $constants = $reflection->getConstants(); $pattern = '/^CHANGETRACKING_/'; @@ -731,7 +735,7 @@ public function testGetChangeTrackingPolicyString(): void } $expected = preg_replace($pattern, '', $name); - $actual = $method->invoke($this->_generator, $value); + $actual = $method->invoke($this->generator, $value); $this->assertEquals($expected, $actual); } @@ -739,7 +743,7 @@ public function testGetChangeTrackingPolicyString(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid provided ChangeTrackingPolicy: INVALID'); - $method->invoke($this->_generator, 'INVALID'); + $method->invoke($this->generator, 'INVALID'); } /** @@ -748,7 +752,7 @@ public function testGetChangeTrackingPolicyString(): void public function testGetIdGeneratorTypeString(): void { $reflection = new ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadataInfo'); - $method = new ReflectionMethod($this->_generator, 'getIdGeneratorTypeString'); + $method = new ReflectionMethod($this->generator, 'getIdGeneratorTypeString'); $constants = $reflection->getConstants(); $pattern = '/^GENERATOR_TYPE_/'; @@ -760,7 +764,7 @@ public function testGetIdGeneratorTypeString(): void } $expected = preg_replace($pattern, '', $name); - $actual = $method->invoke($this->_generator, $value); + $actual = $method->invoke($this->generator, $value); $this->assertEquals($expected, $actual); } @@ -768,7 +772,7 @@ public function testGetIdGeneratorTypeString(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid provided IdGeneratorType: INVALID'); - $method->invoke($this->_generator, 'INVALID'); + $method->invoke($this->generator, 'INVALID'); } /** @@ -778,7 +782,7 @@ public function testGetIdGeneratorTypeString(): void public function testEntityTypeAlias(array $field): void { $metadata = $this->generateEntityTypeFixture($field); - $path = $this->_tmpDir . '/' . $this->_namespace . '/EntityType.php'; + $path = $this->tmpDir . '/' . $this->namespace . '/EntityType.php'; $this->assertFileExists($path); require_once $path; @@ -811,13 +815,13 @@ public function testTraitPropertiesAndMethodsAreNotDuplicated(): void $user = new DDC2372User(); $metadata = $cmf->getMetadataFor(get_class($user)); - $metadata->name = $this->_namespace . '\DDC2372User'; - $metadata->namespace = $this->_namespace; + $metadata->name = $this->namespace . '\DDC2372User'; + $metadata->namespace = $this->namespace; - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/DDC2372User.php'); - require $this->_tmpDir . '/' . $this->_namespace . '/DDC2372User.php'; + $this->assertFileExists($this->tmpDir . '/' . $this->namespace . '/DDC2372User.php'); + require $this->tmpDir . '/' . $this->namespace . '/DDC2372User.php'; $reflClass = new ReflectionClass($metadata->name); @@ -837,13 +841,13 @@ public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses(): v $user = new DDC2372Admin(); $metadata = $cmf->getMetadataFor(get_class($user)); - $metadata->name = $this->_namespace . '\DDC2372Admin'; - $metadata->namespace = $this->_namespace; + $metadata->name = $this->namespace . '\DDC2372Admin'; + $metadata->namespace = $this->namespace; - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $this->assertFileExists($this->_tmpDir . '/' . $this->_namespace . '/DDC2372Admin.php'); - require $this->_tmpDir . '/' . $this->_namespace . '/DDC2372Admin.php'; + $this->assertFileExists($this->tmpDir . '/' . $this->namespace . '/DDC2372Admin.php'); + require $this->tmpDir . '/' . $this->namespace . '/DDC2372Admin.php'; $reflClass = new ReflectionClass($metadata->name); @@ -862,8 +866,8 @@ public function testMethodsAndPropertiesAreNotDuplicatedInChildClasses(): void $cmf->setEntityManager($em); - $ns = $this->_namespace; - $nsdir = $this->_tmpDir . '/' . $ns; + $ns = $this->namespace; + $nsdir = $this->tmpDir . '/' . $ns; $content = str_replace( 'namespace Doctrine\Tests\Models\DDC1590', @@ -876,7 +880,7 @@ public function testMethodsAndPropertiesAreNotDuplicatedInChildClasses(): void require $fname; $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); // class DDC1590User extends DDC1590Entity { ... } $source = file_get_contents($fname); @@ -966,7 +970,7 @@ public function testGeneratedMutableEmbeddablesClass(): void */ public function testGeneratedImmutableEmbeddablesClass(): void { - $this->_generator->setEmbeddablesImmutable(true); + $this->generator->setEmbeddablesImmutable(true); $embeddedMetadata = $this->generateTestEmbeddableFixture(); $metadata = $this->generateIsbnEmbeddableFixture(['test' => $embeddedMetadata]); @@ -1041,20 +1045,25 @@ public function testRegenerateEntityClass(): void $this->loadEntityClass($metadata); $className = basename(str_replace('\\', '/', $metadata->name)); - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; + $path = $this->tmpDir . '/' . $this->namespace . '/' . $className . '.php'; $classTest = file_get_contents($path); - $this->_generator->setRegenerateEntityIfExists(true); - $this->_generator->setBackupExisting(false); + $this->generator->setRegenerateEntityIfExists(true); + $this->generator->setBackupExisting(false); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); $classNew = file_get_contents($path); $this->assertSame($classTest, $classNew); } /** - * @return array + * @return list */ public function getEntityTypeAliasDataProvider(): array { @@ -1150,7 +1159,10 @@ public function getEntityTypeAliasDataProvider(): array ]; } - public function getParseTokensInEntityFileData() + /** + * @psalm-return list + */ + public function getParseTokensInEntityFileData(): array { return [ [ @@ -1227,14 +1239,14 @@ private function assertPhpDocParamType(string $type, ReflectionMethod $method): */ public function testOptionsAreGeneratedProperly(string $expectedAnnotation, array $fieldConfiguration): void { - $metadata = new ClassMetadataInfo($this->_namespace . '\GH6703Options'); - $metadata->namespace = $this->_namespace; + $metadata = new ClassMetadataInfo($this->namespace . '\GH6703Options'); + $metadata->namespace = $this->namespace; $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); $metadata->mapField(['fieldName' => 'test'] + $fieldConfiguration); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR . $this->_namespace . DIRECTORY_SEPARATOR . 'GH6703Options.php'; + $filename = $this->tmpDir . DIRECTORY_SEPARATOR . $this->namespace . DIRECTORY_SEPARATOR . 'GH6703Options.php'; self::assertFileExists($filename); require_once $filename; diff --git a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php index 1bca8a7f136..6ee5fb27bf4 100644 --- a/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/EntityRepositoryGeneratorTest.php @@ -35,36 +35,39 @@ class EntityRepositoryGeneratorTest extends OrmTestCase use VerifyDeprecations; /** @var EntityGenerator */ - private $_generator; + private $generator; /** @var EntityRepositoryGenerator */ - private $_repositoryGenerator; + private $repositoryGenerator; - private $_tmpDir; - private $_namespace; + /** @var string */ + private $tmpDir; + + /** @var string */ + private $namespace; protected function setUp(): void { - $this->_namespace = uniqid('doctrine_'); - $this->_tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $this->_namespace; - mkdir($this->_tmpDir); - - $this->_generator = new EntityGenerator(); - $this->_generator->setAnnotationPrefix(''); - $this->_generator->setGenerateAnnotations(true); - $this->_generator->setGenerateStubMethods(true); - $this->_generator->setRegenerateEntityIfExists(false); - $this->_generator->setUpdateEntityIfExists(true); - $this->_generator->setFieldVisibility(EntityGenerator::FIELD_VISIBLE_PROTECTED); - - $this->_repositoryGenerator = new EntityRepositoryGenerator(); + $this->namespace = uniqid('doctrine_'); + $this->tmpDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $this->namespace; + mkdir($this->tmpDir); + + $this->generator = new EntityGenerator(); + $this->generator->setAnnotationPrefix(''); + $this->generator->setGenerateAnnotations(true); + $this->generator->setGenerateStubMethods(true); + $this->generator->setRegenerateEntityIfExists(false); + $this->generator->setUpdateEntityIfExists(true); + $this->generator->setFieldVisibility(EntityGenerator::FIELD_VISIBLE_PROTECTED); + + $this->repositoryGenerator = new EntityRepositoryGenerator(); } public function tearDown(): void { $dirs = []; - $ri = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->_tmpDir)); + $ri = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->tmpDir)); foreach ($ri as $file) { assert($file instanceof SplFileInfo); if ($file->isFile()) { @@ -93,7 +96,7 @@ public function ensureTestGeneratedDeprecationMessages(): void public function testGeneratedEntityRepositoryClass(): void { $em = $this->getTestEntityManager(); - $ns = $this->_namespace; + $ns = $this->namespace; $className = $ns . '\DDC3231User1Tmp'; $this->writeEntityClass(DDC3231User1::class, $className); @@ -134,7 +137,7 @@ public function testGeneratedEntityRepositoryClass(): void public function testGeneratedEntityRepositoryClassCustomDefaultRepository(): void { $em = $this->getTestEntityManager(); - $ns = $this->_namespace; + $ns = $this->namespace; $className = $ns . '\DDC3231User2Tmp'; $this->writeEntityClass(DDC3231User2::class, $className); @@ -179,21 +182,21 @@ private function writeEntityClass(string $className, string $newClassName): void $cmf->setEntityManager($em); $metadata = $cmf->getMetadataFor($className); - $metadata->namespace = $this->_namespace; + $metadata->namespace = $this->namespace; $metadata->name = $newClassName; $metadata->customRepositoryClassName = $newClassName . 'Repository'; - $this->_generator->writeEntityClass($metadata, $this->_tmpDir); + $this->generator->writeEntityClass($metadata, $this->tmpDir); - require $this->_tmpDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $newClassName) . '.php'; + require $this->tmpDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $newClassName) . '.php'; } private function writeRepositoryClass(string $className, ?string $defaultRepository = null): string { - $this->_repositoryGenerator->setDefaultRepositoryName($defaultRepository); + $this->repositoryGenerator->setDefaultRepositoryName($defaultRepository); - $this->_repositoryGenerator->writeEntityRepositoryClass($className . 'Repository', $this->_tmpDir); + $this->repositoryGenerator->writeEntityRepositoryClass($className . 'Repository', $this->tmpDir); - return $this->_tmpDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . 'Repository.php'; + return $this->tmpDir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . 'Repository.php'; } } diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php index ee8bcb3485a..850474e89ba 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php @@ -50,9 +50,9 @@ abstract class AbstractClassMetadataExporterTest extends OrmTestCase use VerifyDeprecations; /** @var string|null */ - protected $_extension; + protected $extension; - abstract protected function _getType(): string; + abstract protected function getType(): string; protected function createEntityManager($metadataDriver): EntityManagerMock { @@ -98,9 +98,9 @@ protected function createClassMetadataFactory(EntityManagerInterface $em, string public function testExportDirectoryAndFilesAreCreated(): void { - $this->deleteDirectory(__DIR__ . '/export/' . $this->_getType()); + $this->deleteDirectory(__DIR__ . '/export/' . $this->getType()); - $type = $this->_getType(); + $type = $this->getType(); $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/' . $type); $em = $this->createEntityManager($metadataDriver); $cmf = $this->createClassMetadataFactory($em, $type); @@ -110,7 +110,7 @@ public function testExportDirectoryAndFilesAreCreated(): void $this->assertEquals(ExportedUser::class, $metadata[0]->name); - $type = $this->_getType(); + $type = $this->getType(); $cme = new ClassMetadataExporter(); $exporter = $cme->getExporter($type, __DIR__ . '/export/' . $type); @@ -121,15 +121,15 @@ public function testExportDirectoryAndFilesAreCreated(): void $exporter->setEntityGenerator($entityGenerator); } - $this->_extension = $exporter->getExtension(); + $this->extension = $exporter->getExtension(); $exporter->setMetadata($metadata); $exporter->export(); if ($type === 'annotation') { - $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/' . str_replace('\\', '/', ExportedUser::class) . $this->_extension)); + $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/' . str_replace('\\', '/', ExportedUser::class) . $this->extension)); } else { - $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser' . $this->_extension)); + $this->assertTrue(file_exists(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser' . $this->extension)); } $this->assertHasDeprecationMessages(); @@ -140,7 +140,7 @@ public function testExportDirectoryAndFilesAreCreated(): void */ public function testExportedMetadataCanBeReadBackIn(): ClassMetadataInfo { - $type = $this->_getType(); + $type = $this->getType(); $metadataDriver = $this->createMetadataDriver($type, __DIR__ . '/export/' . $type); $em = $this->createEntityManager($metadataDriver); @@ -222,7 +222,7 @@ public function testFieldsAreExported(ClassMetadataInfo $class): ClassMetadataIn */ public function testFieldsAreProperlySerialized(): void { - $type = $this->_getType(); + $type = $this->getType(); if ($type === 'xml') { $xml = simplexml_load_file(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); @@ -361,7 +361,7 @@ public function testInversedByIsExported(ClassMetadataInfo $class): void */ public function testCascadeAllCollapsed(): void { - $type = $this->_getType(); + $type = $this->getType(); if ($type === 'xml') { $xml = simplexml_load_file(__DIR__ . '/export/' . $type . '/Doctrine.Tests.ORM.Tools.Export.ExportedUser.dcm.xml'); diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/AnnotationClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/AnnotationClassMetadataExporterTest.php index 379853fd754..f9a4552356a 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/AnnotationClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/AnnotationClassMetadataExporterTest.php @@ -11,7 +11,7 @@ */ class AnnotationClassMetadataExporterTest extends AbstractClassMetadataExporterTest { - protected function _getType(): string + protected function getType(): string { return 'annotation'; } diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/PhpClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/PhpClassMetadataExporterTest.php index 95fdb3f91ee..e93c8e17d5b 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/PhpClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/PhpClassMetadataExporterTest.php @@ -11,7 +11,7 @@ */ class PhpClassMetadataExporterTest extends AbstractClassMetadataExporterTest { - protected function _getType(): string + protected function getType(): string { return 'php'; } diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/XmlClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/XmlClassMetadataExporterTest.php index d49ccff47d9..5586284fcdf 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/XmlClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/XmlClassMetadataExporterTest.php @@ -15,7 +15,7 @@ */ class XmlClassMetadataExporterTest extends AbstractClassMetadataExporterTest { - protected function _getType(): string + protected function getType(): string { return 'xml'; } diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/YamlClassMetadataExporterTest.php b/tests/Doctrine/Tests/ORM/Tools/Export/YamlClassMetadataExporterTest.php index 2ff2583ead1..a031a3ea99f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/YamlClassMetadataExporterTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/YamlClassMetadataExporterTest.php @@ -13,7 +13,7 @@ */ class YamlClassMetadataExporterTest extends AbstractClassMetadataExporterTest { - protected function _getType(): string + protected function getType(): string { if (! class_exists('Symfony\Component\Yaml\Yaml', true)) { $this->markTestSkipped('Please install Symfony YAML Component into the include path of your PHP installation.'); diff --git a/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php b/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php index 0588417d01f..0cf0169080f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php +++ b/tests/Doctrine/Tests/ORM/Tools/Export/annotation/Doctrine.Tests.ORM.Tools.Export.User.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\ORM\Tools\Export; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @HasLifecycleCallbacks @@ -16,34 +18,53 @@ */ class User { - /** @Id @Column(type="integer") @generatedValue(strategy="AUTO") */ + /** + * @var int + * @Id + * @Column(type="integer") @generatedValue(strategy="AUTO") + */ public $id; - /** @Column(length=50, nullable=true, unique=true) */ + /** + * @var string + * @Column(length=50, nullable=true, unique=true) + */ public $name; - /** @Column(name="user_email", columnDefinition="CHAR(32) NOT NULL") */ + /** + * @var string + * @Column(name="user_email", columnDefinition="CHAR(32) NOT NULL") + */ public $email; - /** @Column(type="integer", options={"unsigned"=true}) */ + /** + * @var int + * @Column(type="integer", options={"unsigned"=true}) + */ public $age; /** + * @var Address * @OneToOne(targetEntity="Doctrine\Tests\ORM\Tools\Export\Address", inversedBy="user", cascade={"persist"}, orphanRemoval=true, fetch="EAGER") * @JoinColumn(name="address_id", onDelete="CASCADE") */ public $address; - /** @ManyToOne(targetEntity="Doctrine\Tests\ORM\Tools\Export\Group") */ + /** + * @var Group + * @ManyToOne(targetEntity="Doctrine\Tests\ORM\Tools\Export\Group") + */ public $mainGroup; /** + * @psalm-var Collection * @OneToMany(targetEntity="Doctrine\Tests\ORM\Tools\Export\Phonenumber", mappedBy="user", cascade={"persist", "merge"}, orphanRemoval=true) * @OrderBy({"number"="ASC"}) */ public $phonenumbers; /** + * @psalm-var Collection * @ManyToMany(targetEntity="Doctrine\Tests\ORM\Tools\Export\Group", cascade={"all"}, fetch="EXTRA_LAZY") * @JoinTable(name="cms_users_groups", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id", nullable=false, unique=false)}, diff --git a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php index 7c2606f4a88..bab52c3844f 100644 --- a/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/ResolveTargetEntityListenerTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Tools; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\EntityManager; use Doctrine\ORM\Events; use Doctrine\ORM\Mapping\ClassMetadataFactory; @@ -37,8 +38,8 @@ protected function setUp(): void public function testResolveTargetEntityListenerCanResolveTargetEntity(): void { $evm = $this->em->getEventManager(); - $this->listener->addResolveTargetEntity(ResolveTargetInterface::class, ResolveTargetEntity::class, []); - $this->listener->addResolveTargetEntity(TargetInterface::class, TargetEntity::class, []); + $this->listener->addResolveTargetEntity(ResolveTarget::class, ResolveTargetEntity::class, []); + $this->listener->addResolveTargetEntity(Target::class, TargetEntity::class, []); $evm->addEventSubscriber($this->listener); $cm = $this->factory->getMetadataFor(ResolveTargetEntity::class); @@ -49,7 +50,7 @@ public function testResolveTargetEntityListenerCanResolveTargetEntity(): void $this->assertSame(ResolveTargetEntity::class, $meta['oneToMany']['targetEntity']); $this->assertSame(TargetEntity::class, $meta['oneToOne']['targetEntity']); - $this->assertSame($cm, $this->factory->getMetadataFor(ResolveTargetInterface::class)); + $this->assertSame($cm, $this->factory->getMetadataFor(ResolveTarget::class)); } /** @@ -59,11 +60,11 @@ public function testResolveTargetEntityListenerCanResolveTargetEntity(): void */ public function testResolveTargetEntityListenerCanRetrieveTargetEntityByInterfaceName(): void { - $this->listener->addResolveTargetEntity(ResolveTargetInterface::class, ResolveTargetEntity::class, []); + $this->listener->addResolveTargetEntity(ResolveTarget::class, ResolveTargetEntity::class, []); $this->em->getEventManager()->addEventSubscriber($this->listener); - $cm = $this->factory->getMetadataFor(ResolveTargetInterface::class); + $cm = $this->factory->getMetadataFor(ResolveTarget::class); $this->assertSame($this->factory->getMetadataFor(ResolveTargetEntity::class), $cm); } @@ -74,15 +75,15 @@ public function testResolveTargetEntityListenerCanRetrieveTargetEntityByInterfac public function testAssertTableColumnsAreNotAddedInManyToMany(): void { $evm = $this->em->getEventManager(); - $this->listener->addResolveTargetEntity(ResolveTargetInterface::class, ResolveTargetEntity::class, []); - $this->listener->addResolveTargetEntity(TargetInterface::class, TargetEntity::class, []); + $this->listener->addResolveTargetEntity(ResolveTarget::class, ResolveTargetEntity::class, []); + $this->listener->addResolveTargetEntity(Target::class, TargetEntity::class, []); $evm->addEventListener(Events::loadClassMetadata, $this->listener); $cm = $this->factory->getMetadataFor(ResolveTargetEntity::class); $meta = $cm->associationMappings['manyToMany']; $this->assertSame(TargetEntity::class, $meta['targetEntity']); - $this->assertEquals(['resolvetargetentity_id', 'targetinterface_id'], $meta['joinTableColumns']); + $this->assertEquals(['resolvetargetentity_id', 'target_id'], $meta['joinTableColumns']); } /** @@ -93,7 +94,7 @@ public function testAssertTableColumnsAreNotAddedInManyToMany(): void public function testDoesResolveTargetEntitiesInDQLAlsoWithInterfaces(): void { $evm = $this->em->getEventManager(); - $this->listener->addResolveTargetEntity(ResolveTargetInterface::class, ResolveTargetEntity::class, []); + $this->listener->addResolveTargetEntity(ResolveTarget::class, ResolveTargetEntity::class, []); $evm->addEventSubscriber($this->listener); @@ -101,25 +102,25 @@ public function testDoesResolveTargetEntitiesInDQLAlsoWithInterfaces(): void 'SELECT%AFROM ResolveTargetEntity%A', $this ->em - ->createQuery('SELECT f FROM Doctrine\Tests\ORM\Tools\ResolveTargetInterface f') + ->createQuery('SELECT f FROM Doctrine\Tests\ORM\Tools\ResolveTarget f') ->getSQL() ); } } -interface ResolveTargetInterface +interface ResolveTarget { public function getId(): int; } -interface TargetInterface extends ResolveTargetInterface +interface Target extends ResolveTarget { } /** * @Entity */ -class ResolveTargetEntity implements ResolveTargetInterface +class ResolveTargetEntity implements ResolveTarget { /** * @var int @@ -129,17 +130,27 @@ class ResolveTargetEntity implements ResolveTargetInterface */ private $id; - /** @ManyToMany(targetEntity="Doctrine\Tests\ORM\Tools\TargetInterface") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="Doctrine\Tests\ORM\Tools\Target") + */ private $manyToMany; - /** @ManyToOne(targetEntity="Doctrine\Tests\ORM\Tools\ResolveTargetInterface", inversedBy="oneToMany") */ + /** + * @var ResolveTarget + * @ManyToOne(targetEntity="Doctrine\Tests\ORM\Tools\ResolveTarget", inversedBy="oneToMany") + */ private $manyToOne; - /** @OneToMany(targetEntity="Doctrine\Tests\ORM\Tools\ResolveTargetInterface", mappedBy="manyToOne") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="Doctrine\Tests\ORM\Tools\ResolveTarget", mappedBy="manyToOne") + */ private $oneToMany; /** - * @OneToOne(targetEntity="Doctrine\Tests\ORM\Tools\TargetInterface") + * @var Target + * @OneToOne(targetEntity="Doctrine\Tests\ORM\Tools\Target") * @JoinColumn(name="target_entity_id", referencedColumnName="id") */ private $oneToOne; @@ -153,9 +164,10 @@ public function getId(): int /** * @Entity */ -class TargetEntity implements TargetInterface +class TargetEntity implements Target { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php index 42f11891140..4622c217673 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SchemaToolTest.php @@ -378,7 +378,7 @@ class SecondEntity * @Id * @Column(name="first_entity_id") */ - public $first_entity_id; + public $firstEntityId; /** * @var string diff --git a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php index 1bf2056078f..95e37756310 100644 --- a/tests/Doctrine/Tests/ORM/Tools/SetupTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/SetupTest.php @@ -25,7 +25,10 @@ class SetupTest extends OrmTestCase { use VerifyDeprecations; + /** @var int */ private $originalAutoloaderCount; + + /** @var string */ private $originalIncludePath; protected function setUp(): void From 01374ca2aba0c99c0b7197ed124ce6a0fe570105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 12 Feb 2021 07:39:56 +0100 Subject: [PATCH 10/27] Ignore rule about lone comment That comment is mistaken for a method comment because it precedes one. The issue was reported but will most likely not be fixed. --- phpcs.xml.dist | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index edefbf8c6bc..f8561f48050 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -189,4 +189,9 @@ lib/Doctrine/ORM/Tools/EntityGenerator.php + + + + tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php + From 01ca442be741db4312d7cf74a7a906df92dd73b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 12 Feb 2021 08:44:43 +0100 Subject: [PATCH 11/27] Ignore error about no assignment These files must be require'd --- phpcs.xml.dist | 4 ++++ .../Doctrine.Tests.Models.DDC2825.ExplicitSchemaAndTable.php | 1 - ...octrine.Tests.Models.DDC2825.SchemaAndTableInTableName.php | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index f8561f48050..f3542e31d14 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -194,4 +194,8 @@ tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php + + + tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests* + diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.ExplicitSchemaAndTable.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.ExplicitSchemaAndTable.php index 6f2cb73b445..46d2a25a2db 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.ExplicitSchemaAndTable.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.ExplicitSchemaAndTable.php @@ -5,7 +5,6 @@ use Doctrine\ORM\Mapping\ClassMetadata; /** @var ClassMetadata $metadata */ - $metadata->setPrimaryTable( [ 'name' => 'explicit_table', diff --git a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.SchemaAndTableInTableName.php b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.SchemaAndTableInTableName.php index 7b3ccb8295c..ff318fd2079 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.SchemaAndTableInTableName.php +++ b/tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.DDC2825.SchemaAndTableInTableName.php @@ -5,7 +5,6 @@ use Doctrine\ORM\Mapping\ClassMetadata; /** @var ClassMetadata $metadata */ - $metadata->setPrimaryTable( ['name' => 'implicit_schema.implicit_table'] ); From 4c8831f716f08b2c53c50c06f93fcc78e3800d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 12 Feb 2021 20:04:18 +0100 Subject: [PATCH 12/27] Remove unused helper method --- .../Tests/ORM/Hydration/HydrationTestCase.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php index 17e44527f27..494ebb05379 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php @@ -4,7 +4,6 @@ namespace Doctrine\Tests\ORM\Hydration; -use Doctrine\ORM\Query\ParserResult; use Doctrine\Tests\OrmTestCase; class HydrationTestCase extends OrmTestCase @@ -16,16 +15,4 @@ protected function setUp(): void parent::setUp(); $this->_em = $this->getTestEntityManager(); } - - /** Helper method */ - protected function _createParserResult($resultSetMapping, $isMixedQuery = false) - { - $parserResult = new ParserResult(); - $parserResult->setResultSetMapping($resultSetMapping); - //$parserResult->setDefaultQueryComponentAlias(key($queryComponents)); - //$parserResult->setTableAliasMap($tableToClassAliasMap); - $parserResult->setMixedQuery($isMixedQuery); - - return $parserResult; - } } From f59a0c349bf7df908b5d35e5c099f5dfb0556f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 12 Feb 2021 07:51:38 +0100 Subject: [PATCH 13/27] Manually fix cs --- .../Internal/Hydration/AbstractHydrator.php | 2 +- .../ORM/Functional/Ticket/DDC1209Test.php | 78 +++++++++-------- .../ORM/Functional/Ticket/GH6531Test.php | 73 +++++++++++++--- .../ORM/Functional/Ticket/GH7836Test.php | 20 ++++- .../ORM/Functional/Ticket/GH7864Test.php | 25 +++++- .../ORM/Functional/Ticket/GH7869Test.php | 24 +++++- .../ORM/Functional/Ticket/GH7875Test.php | 14 ++- .../ORM/Functional/Ticket/GH7941Test.php | 11 ++- .../ORM/Functional/Ticket/GH8055Test.php | 1 + .../ORM/Functional/Ticket/GH8061Test.php | 12 ++- .../ORM/Functional/Ticket/Ticket2481Test.php | 1 + .../Ticket4646InstanceOfAbstractTest.php | 1 + .../Ticket4646InstanceOfMultiLevelTest.php | 1 + .../Ticket4646InstanceOfParametricTest.php | 1 + .../Ticket/Ticket4646InstanceOfTest.php | 1 + ...46InstanceOfWithMultipleParametersTest.php | 3 +- .../Tests/ORM/Functional/Ticket/Ticket69.php | 4 +- .../Tests/ORM/Hydration/ArrayHydratorTest.php | 43 +++++----- .../ORM/Hydration/CustomHydratorTest.php | 3 + .../Tests/ORM/Hydration/HydrationTestCase.php | 6 +- .../ORM/Hydration/ObjectHydratorTest.php | 85 ++++++++++--------- .../ORM/Hydration/ScalarHydratorTest.php | 6 +- .../Hydration/SimpleObjectHydratorTest.php | 8 +- .../Hydration/SingleScalarHydratorTest.php | 2 +- .../Tests/ORM/Id/AssignedGeneratorTest.php | 19 ++++- .../Internal/HydrationCompleteHandlerTest.php | 7 +- .../Mapping/BasicInheritanceMappingTest.php | 29 ++++++- .../Mapping/ClassMetadataLoadEventTest.php | 8 +- .../Tests/ORM/Mapping/ClassMetadataTest.php | 5 +- .../ORM/Mapping/XmlMappingDriverTest.php | 16 +++- .../ORM/Mapping/YamlMappingDriverTest.php | 3 + .../ORM/Performance/SecondLevelCacheTest.php | 17 ++-- ...tyPersisterCompositeTypeParametersTest.php | 18 ++-- ...sicEntityPersisterCompositeTypeSqlTest.php | 16 ++-- .../BasicEntityPersisterTypeValueSqlTest.php | 46 +++++----- .../ORM/Query/CustomTreeWalkersJoinTest.php | 4 +- .../Tests/ORM/Query/CustomTreeWalkersTest.php | 23 ++++- 37 files changed, 431 insertions(+), 205 deletions(-) diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index f84b1355411..02fbef3b0e9 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -294,7 +294,7 @@ protected function hydrateRowData(array $row, array &$result) /** * Hydrates all rows from the current statement instance at once. * - * @return array + * @return mixed[] */ abstract protected function hydrateAllData(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php index ec96efdaa29..13e78749a69 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php @@ -16,9 +16,9 @@ protected function setUp(): void try { $this->_schemaTool->createSchema( [ - $this->_em->getClassMetadata(DDC1209_1::class), - $this->_em->getClassMetadata(DDC1209_2::class), - $this->_em->getClassMetadata(DDC1209_3::class), + $this->_em->getClassMetadata(DDC1209One::class), + $this->_em->getClassMetadata(DDC1209Two::class), + $this->_em->getClassMetadata(DDC1209Three::class), ] ); } catch (Exception $e) { @@ -30,12 +30,12 @@ protected function setUp(): void */ public function testIdentifierCanHaveCustomType(): void { - $entity = new DDC1209_3(); + $entity = new DDC1209Three(); $this->_em->persist($entity); $this->_em->flush(); - self::assertSame($entity, $this->_em->find(DDC1209_3::class, $entity->date)); + self::assertSame($entity, $this->_em->find(DDC1209Three::class, $entity->date)); } /** @@ -43,12 +43,12 @@ public function testIdentifierCanHaveCustomType(): void */ public function testCompositeIdentifierCanHaveCustomType(): void { - $future1 = new DDC1209_1(); + $future1 = new DDC1209One(); $this->_em->persist($future1); $this->_em->flush(); - $future2 = new DDC1209_2($future1); + $future2 = new DDC1209Two($future1); $this->_em->persist($future2); $this->_em->flush(); @@ -56,12 +56,12 @@ public function testCompositeIdentifierCanHaveCustomType(): void self::assertSame( $future2, $this->_em->find( - DDC1209_2::class, + DDC1209Two::class, [ 'future1' => $future1, - 'starting_datetime' => $future2->starting_datetime, - 'during_datetime' => $future2->during_datetime, - 'ending_datetime' => $future2->ending_datetime, + 'startingDatetime' => $future2->startingDatetime, + 'duringDatetime' => $future2->duringDatetime, + 'endingDatetime' => $future2->endingDatetime, ] ) ); @@ -71,12 +71,16 @@ public function testCompositeIdentifierCanHaveCustomType(): void /** * @Entity */ -class DDC1209_1 +class DDC1209One { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue @Column(type="integer") + */ private $id; - public function getId() + public function getId(): int { return $this->id; } @@ -85,47 +89,53 @@ public function getId() /** * @Entity */ -class DDC1209_2 +class DDC1209Two { /** - * @Id - * @ManyToOne(targetEntity="DDC1209_1") - * @JoinColumn(referencedColumnName="id", nullable=false) + * @var DDC1209One + * @Id + * @ManyToOne(targetEntity="DDC1209One") + * @JoinColumn(referencedColumnName="id", nullable=false) */ private $future1; + /** - * @Id - * @Column(type="datetime", nullable=false) + * @var DateTime2 + * @Id + * @Column(type="datetime", nullable=false) */ - public $starting_datetime; + public $startingDatetime; /** - * @Id - * @Column(type="datetime", nullable=false) + * @var DateTime2 + * @Id + * @Column(type="datetime", nullable=false) */ - public $during_datetime; + public $duringDatetime; /** - * @Id - * @Column(type="datetime", nullable=false) + * @var DateTime2 + * @Id + * @Column(type="datetime", nullable=false) */ - public $ending_datetime; + public $endingDatetime; - public function __construct(DDC1209_1 $future1) + public function __construct(DDC1209One $future1) { - $this->future1 = $future1; - $this->starting_datetime = new DateTime2(); - $this->during_datetime = new DateTime2(); - $this->ending_datetime = new DateTime2(); + $this->future1 = $future1; + $this->startingDatetime = new DateTime2(); + $this->duringDatetime = new DateTime2(); + $this->endingDatetime = new DateTime2(); } } /** * @Entity */ -class DDC1209_3 +class DDC1209Three { /** + * @var DateTime2 * @Id * @Column(type="datetime", name="somedate") */ @@ -139,7 +149,7 @@ public function __construct() class DateTime2 extends DateTime { - public function __toString() + public function __toString(): string { return $this->format('Y'); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php index 7529d5f2fbb..11a8813a9a8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6531Test.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; final class GH6531Test extends OrmFunctionalTestCase @@ -85,7 +86,12 @@ public function testJoinTableWithMetadata(): void */ class GH6531User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -94,7 +100,11 @@ class GH6531User */ class GH6531Address { - /** @Id @OneToOne(targetEntity=GH6531User::class) */ + /** + * @var GH6531User + * @Id + * @OneToOne(targetEntity=GH6531User::class) + */ public $user; } @@ -103,10 +113,18 @@ class GH6531Address */ class GH6531Article { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @OneToMany(targetEntity=GH6531ArticleAttribute::class, mappedBy="article", cascade={"ALL"}, indexBy="attribute") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity=GH6531ArticleAttribute::class, mappedBy="article", cascade={"ALL"}, indexBy="attribute") + * */ public $attributes; public function addAttribute(string $name, string $value): void @@ -120,10 +138,18 @@ public function addAttribute(string $name, string $value): void */ class GH6531ArticleAttribute { - /** @Id @ManyToOne(targetEntity=GH6531Article::class, inversedBy="attributes") */ + /** + * @var GH6531Article + * @Id + * @ManyToOne(targetEntity=GH6531Article::class, inversedBy="attributes") + */ public $article; - /** @Id @Column(type="string") */ + /** + * @var string + * @Id + * @Column(type="string") + */ public $attribute; /** @@ -145,10 +171,18 @@ public function __construct(string $name, string $value, GH6531Article $article) */ class GH6531Order { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @OneToMany(targetEntity=GH6531OrderItem::class, mappedBy="order", cascade={"ALL"}) */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity=GH6531OrderItem::class, mappedBy="order", cascade={"ALL"}) + */ public $items; public function __construct() @@ -167,7 +201,12 @@ public function addItem(GH6531Product $product, int $amount): void */ class GH6531Product { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -176,13 +215,23 @@ class GH6531Product */ class GH6531OrderItem { - /** @Id @ManyToOne(targetEntity=GH6531Order::class) */ + /** + * @var GH6531Order + * @Id + * @ManyToOne(targetEntity=GH6531Order::class) + */ public $order; - /** @Id @ManyToOne(targetEntity=GH6531Product::class) */ + /** + * @var GH6531Product + * @Id @ManyToOne(targetEntity=GH6531Product::class) + */ public $product; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $amount = 1; public function __construct(GH6531Order $order, GH6531Product $product, int $amount = 1) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php index f1f8309324a..4413abccea5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7836Test.php @@ -4,8 +4,8 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; -use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\OrmFunctionalTestCase; use function assert; @@ -83,6 +83,7 @@ public function testMatchingKeepsOrderOfCriteriaOrderingKeys(): void class GH7836ParentEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -90,6 +91,7 @@ class GH7836ParentEntity private $id; /** + * @var Collection * @OneToMany(targetEntity=GH7836ChildEntity::class, mappedBy="parent", fetch="EXTRA_LAZY", cascade={"persist"}) * @OrderBy({"position" = "ASC", "name" = "ASC"}) */ @@ -100,7 +102,10 @@ public function addChild(int $position, string $name): void $this->children[] = new GH7836ChildEntity($this, $position, $name); } - public function getChildren(): PersistentCollection + /** + * @psalm-return Collection + */ + public function getChildren(): Collection { return $this->children; } @@ -112,13 +117,17 @@ public function getChildren(): PersistentCollection class GH7836ChildEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ private $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $position; /** @@ -127,7 +136,10 @@ class GH7836ChildEntity */ public $name; - /** @ManyToOne(targetEntity=GH7836ParentEntity::class, inversedBy="children") */ + /** + * @var GH7836ParentEntity + * @ManyToOne(targetEntity=GH7836ParentEntity::class, inversedBy="children") + */ private $parent; public function __construct(GH7836ParentEntity $parent, int $position, string $name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php index e175aab2b4e..c3c92e960b3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7864Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use function array_values; @@ -63,7 +64,12 @@ public function testExtraLazyRemoveElement(): void */ class GH7864User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -72,7 +78,10 @@ class GH7864User */ public $name; - /** @OneToMany(targetEntity="GH7864Tweet", mappedBy="user", fetch="EXTRA_LAZY") */ + /** + * @var Collection + * @OneToMany(targetEntity="GH7864Tweet", mappedBy="user", fetch="EXTRA_LAZY") + */ public $tweets; public function __construct() @@ -92,7 +101,12 @@ public function addTweet(GH7864Tweet $tweet): void */ class GH7864Tweet { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -101,6 +115,9 @@ class GH7864Tweet */ public $content; - /** @ManyToOne(targetEntity="GH7864User", inversedBy="tweets") */ + /** + * @var GH7864User + * @ManyToOne(targetEntity="GH7864User", inversedBy="tweets") + */ public $user; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7869Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7869Test.php index 58beb5b5b80..ded3fa4ca00 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7869Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7869Test.php @@ -47,10 +47,18 @@ public function testDQLDeferredEagerLoad(): void */ class GH7869Appointment { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @OneToOne(targetEntity="GH7869Patient", inversedBy="appointment", fetch="EAGER") */ + /** + * @var GH7869Patient + * @OneToOne(targetEntity="GH7869Patient", inversedBy="appointment", fetch="EAGER") + */ public $patient; } @@ -59,9 +67,17 @@ class GH7869Appointment */ class GH7869Patient { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @OneToOne(targetEntity="GH7869Appointment", mappedBy="patient") */ + /** + * @var GH7869Appointment + * @OneToOne(targetEntity="GH7869Appointment", mappedBy="patient") + */ public $appointment; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7875Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7875Test.php index e5bfc1a1fd5..c9044b4aa7f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7875Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7875Test.php @@ -122,7 +122,12 @@ public function testUpdateSchemaSqlWithSchemaAssetFilter(?string $filterRegex, ? */ class GH7875MyEntity { - /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue(strategy="AUTO") + */ public $id; } @@ -132,6 +137,11 @@ class GH7875MyEntity */ class GH7875MyOtherEntity { - /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue(strategy="AUTO") + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php index 78c3ca2b8f8..04f7ee4bc89 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7941Test.php @@ -78,6 +78,7 @@ public function typesShouldBeConvertedForDQLFunctions(): void class GH7941Product { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -90,10 +91,16 @@ class GH7941Product */ public $name; - /** @Column(type="decimal") */ + /** + * @var string + * @Column(type="decimal") + */ public $price; - /** @Column(type="datetime_immutable") */ + /** + * @var DateTimeImmutable + * @Column(type="datetime_immutable") + */ public $createdAt; public function __construct(string $name, string $price) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php index b8443f30573..d841d9d3788 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8055Test.php @@ -49,6 +49,7 @@ public function testNumericDescriminatorColumn(): void class GH8055BaseClass { /** + * @var int * @Id @GeneratedValue * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php index bbdd3c3b450..19836837638 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php @@ -35,10 +35,18 @@ public function testConvertToPHPValueSQLForNewObjectExpression(): void */ final class GH8061Entity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @Column(type="GH8061Type") */ + /** + * @var mixed + * @Column(type="GH8061Type") + */ public $field; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php index 301efa0e94e..ca323613b9f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php @@ -43,6 +43,7 @@ public function testEmptyInsert(): void class Ticket2481Product { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfAbstractTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfAbstractTest.php index 9b53457d34c..b89a8c647e4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfAbstractTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfAbstractTest.php @@ -45,6 +45,7 @@ public function testInstanceOf(): void abstract class PersonTicket4646Abstract { /** + * @var int * @Id() * @GeneratedValue() * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfMultiLevelTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfMultiLevelTest.php index aea0f5cd13c..4fae6d8bb0d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfMultiLevelTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfMultiLevelTest.php @@ -50,6 +50,7 @@ public function testInstanceOf(): void class PersonTicket4646MultiLevel { /** + * @var int * @Id() * @GeneratedValue() * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfParametricTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfParametricTest.php index d592e15aa76..ee07f9771c8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfParametricTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfParametricTest.php @@ -48,6 +48,7 @@ public function testInstanceOf(): void class PersonTicket4646Parametric { /** + * @var int * @Id() * @GeneratedValue() * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfTest.php index cfa02b08c68..16f042fe8ad 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfTest.php @@ -47,6 +47,7 @@ public function testInstanceOf(): void class PersonTicket4646 { /** + * @var int * @Id() * @GeneratedValue() * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfWithMultipleParametersTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfWithMultipleParametersTest.php index d2412af78a6..feb12cd61c8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfWithMultipleParametersTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfWithMultipleParametersTest.php @@ -53,13 +53,14 @@ public function testInstanceOf(): void class PersonTicket4646Multiple { /** + * @var int * @Id() * @GeneratedValue() * @Column(type="integer") */ private $id; - public function getId() + public function getId(): int { return $this->id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php index 057c0afeb51..9196eecaa52 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket69.php @@ -190,7 +190,7 @@ class Relation private $id; /** - * @var Lemma + * @var Lemma|null * @ManyToOne(targetEntity="Lemma", inversedBy="relations") * @JoinColumn(name="relation_parent_id", referencedColumnName="lemma_id") */ @@ -223,7 +223,6 @@ public function getParent(): Phrase public function removeParent(): void { if ($this->lemma !== null) { - /** @var Lemma $phrase */ $lemma = $this->parent; $this->parent = null; $lemma->removeRelation($this); @@ -253,7 +252,6 @@ public function getType(): RelationType public function removeType(): void { if ($this->type !== null) { - /** @var RelationType $phrase */ $type = $this->type; $this->type = null; $type->removeRelation($this); diff --git a/tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php index 21e262a9213..12b737bb13a 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php @@ -19,7 +19,10 @@ class ArrayHydratorTest extends HydrationTestCase { - public function provideDataForUserEntityResult() + /** + * @psalm-return list + */ + public function provideDataForUserEntityResult(): array { return [ [0], @@ -54,7 +57,7 @@ public function testSimpleEntityQuery(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -98,7 +101,7 @@ public function testSimpleEntityWithScalarQuery($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -146,7 +149,7 @@ public function testSimpleEntityQueryWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -193,7 +196,7 @@ public function testSimpleMultipleRootEntityQuery(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(4, count($result)); @@ -243,7 +246,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(4, count($result)); @@ -297,7 +300,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedArticleEntity(): voi ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(4, count($result)); @@ -351,7 +354,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedEntities(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(4, count($result)); @@ -406,7 +409,7 @@ public function testMixedQueryNormalJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -470,7 +473,7 @@ public function testMixedQueryFetchJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -543,7 +546,7 @@ public function testMixedQueryFetchJoinCustomIndex($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -657,7 +660,7 @@ public function testMixedQueryMultipleFetchJoin(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -796,7 +799,7 @@ public function testMixedQueryMultipleDeepMixedFetchJoin(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -910,7 +913,7 @@ public function testEntityQueryCustomResultSetOrder(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); @@ -973,7 +976,7 @@ public function testChainedJoinWithScalars($entityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(3, count($result)); @@ -1022,7 +1025,7 @@ public function testResultIteration(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $iterator = $hydrator->iterate($stmt, $rsm); $rowNum = 0; @@ -1067,7 +1070,7 @@ public function testResultIterationWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $iterator = $hydrator->iterate($stmt, $rsm); $rowNum = 0; @@ -1112,7 +1115,7 @@ public function testSkipUnknownColumns(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(1, count($result)); @@ -1163,7 +1166,7 @@ public function testMissingIdForRootEntity($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(4, count($result), 'Should hydrate four results.'); @@ -1213,7 +1216,7 @@ public function testIndexByAndMixedResult($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ArrayHydrator($this->_em); + $hydrator = new ArrayHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(2, count($result)); diff --git a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php index 6f8329fda06..8bdb6e21edb 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/CustomHydratorTest.php @@ -23,6 +23,9 @@ public function testCustomHydrator(): void class CustomHydrator extends AbstractHydrator { + /** + * {@inheritDoc} + */ protected function hydrateAllData() { return $this->_stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php index 494ebb05379..0b3de7a1fe2 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php +++ b/tests/Doctrine/Tests/ORM/Hydration/HydrationTestCase.php @@ -4,15 +4,17 @@ namespace Doctrine\Tests\ORM\Hydration; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\Tests\OrmTestCase; class HydrationTestCase extends OrmTestCase { - protected $_em; + /** @var EntityManagerInterface */ + protected $entityManager; protected function setUp(): void { parent::setUp(); - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); } } diff --git a/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php index e11d5cc1323..b440a24eecf 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php @@ -32,7 +32,10 @@ class ObjectHydratorTest extends HydrationTestCase { - public function provideDataForUserEntityResult() + /** + * @psalm-return list + */ + public function provideDataForUserEntityResult(): array { return [ [0], @@ -40,7 +43,10 @@ public function provideDataForUserEntityResult() ]; } - public function provideDataForMultipleRootEntityResult() + /** + * @psalm-return list + */ + public function provideDataForMultipleRootEntityResult(): array { return [ [0, 0], @@ -50,7 +56,10 @@ public function provideDataForMultipleRootEntityResult() ]; } - public function provideDataForProductEntityResult() + /** + * @psalm-return list + */ + public function provideDataForProductEntityResult(): array { return [ [0], @@ -82,7 +91,7 @@ public function testSimpleEntityQuery(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -121,7 +130,7 @@ public function testSimpleEntityQueryWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -170,7 +179,7 @@ public function testSimpleMultipleRootEntityQuery(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(4, count($result)); @@ -224,7 +233,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(4, count($result)); @@ -285,7 +294,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedArticleEntity(): voi ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(4, count($result)); @@ -346,7 +355,7 @@ public function testSimpleMultipleRootEntityQueryWithAliasedEntities(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(4, count($result)); @@ -408,7 +417,7 @@ public function testMixedQueryNormalJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -472,7 +481,7 @@ public function testMixedQueryFetchJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -552,7 +561,7 @@ public function testMixedQueryFetchJoinCustomIndex($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -666,7 +675,7 @@ public function testMixedQueryMultipleFetchJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -796,7 +805,7 @@ public function testMixedQueryMultipleDeepMixedFetchJoin($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -909,7 +918,7 @@ public function testEntityQueryCustomResultSetOrder(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -952,7 +961,7 @@ public function testSkipUnknownColumns(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(1, count($result)); @@ -985,7 +994,7 @@ public function testScalarQueryWithoutResultVariables($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1034,14 +1043,14 @@ public function testCreatesProxyForLazyLoadingWithForeignKeys(): void ->with($this->equalTo(ECommerceShipping::class), ['id' => 42]) ->will($this->returnValue($proxyInstance)); - $this->_em->setProxyFactory($proxyFactory); + $this->entityManager->setProxyFactory($proxyFactory); // configuring lazy loading - $metadata = $this->_em->getClassMetadata(ECommerceProduct::class); + $metadata = $this->entityManager->getClassMetadata(ECommerceProduct::class); $metadata->associationMappings['shipping']['fetch'] = ClassMetadata::FETCH_LAZY; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(1, count($result)); @@ -1083,14 +1092,14 @@ public function testCreatesProxyForLazyLoadingWithForeignKeysWithAliasedProductE ->with($this->equalTo(ECommerceShipping::class), ['id' => 42]) ->will($this->returnValue($proxyInstance)); - $this->_em->setProxyFactory($proxyFactory); + $this->entityManager->setProxyFactory($proxyFactory); // configuring lazy loading - $metadata = $this->_em->getClassMetadata(ECommerceProduct::class); + $metadata = $this->entityManager->getClassMetadata(ECommerceProduct::class); $metadata->associationMappings['shipping']['fetch'] = ClassMetadata::FETCH_LAZY; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals(1, count($result)); @@ -1150,7 +1159,7 @@ public function testChainedJoinWithEmptyCollections(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1213,7 +1222,7 @@ public function testChainedJoinWithEmptyCollectionsWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1251,7 +1260,7 @@ public function testResultIteration(): void ], ]; - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $iterableResult = $hydrator->iterate( new HydratorMockStatement($resultSet), @@ -1326,7 +1335,7 @@ public function testResultIterationWithAliasedUserEntity(): void ], ]; - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $rowNum = 0; $iterableResult = $hydrator->iterate( new HydratorMockStatement($resultSet), @@ -1490,7 +1499,7 @@ public function testManyToManyHydration(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1613,7 +1622,7 @@ public function testManyToManyHydrationWithAliasedUserEntity(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1671,7 +1680,7 @@ public function testMissingIdForRootEntity($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(4, count($result), 'Should hydrate four results.'); @@ -1741,7 +1750,7 @@ public function testMissingIdForCollectionValuedChildEntity($userEntityKey): voi ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1795,7 +1804,7 @@ public function testMissingIdForSingleValuedChildEntity($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1837,7 +1846,7 @@ public function testIndexByAndMixedResult($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals(2, count($result)); @@ -1871,7 +1880,7 @@ public function testIndexByScalarsOnly($userEntityKey): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm, [Query::HINT_FORCE_PARTIAL_LOAD => true]); $this->assertEquals( @@ -1905,7 +1914,7 @@ public function testMissingMetaMappingException(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $hydrator->hydrateAll($stmt, $rsm); } @@ -1938,7 +1947,7 @@ public function testMissingDiscriminatorColumnException(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $hydrator->hydrateAll($stmt, $rsm); } @@ -1966,7 +1975,7 @@ public function testInvalidDiscriminatorValueException(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $hydrator->hydrateAll($stmt, $rsm); } @@ -1987,7 +1996,7 @@ public function testFetchJoinCollectionValuedAssociationWithDefaultArrayValue(): ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ObjectHydrator($this->_em); + $hydrator = new ObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertCount(1, $result); diff --git a/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php index c4b8f11fd58..7d64b2d0311 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/ScalarHydratorTest.php @@ -34,7 +34,7 @@ public function testNewHydrationSimpleEntityQuery(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ScalarHydrator($this->_em); + $hydrator = new ScalarHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); @@ -65,7 +65,7 @@ public function testHydrateScalarResults(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ScalarHydrator($this->_em); + $hydrator = new ScalarHydrator($this->entityManager); self::assertCount(1, $hydrator->hydrateAll($stmt, $rsm)); } @@ -95,7 +95,7 @@ public function testSkipUnknownColumns(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new ScalarHydrator($this->_em); + $hydrator = new ScalarHydrator($this->entityManager); self::assertCount(1, $hydrator->hydrateAll($stmt, $rsm)); } diff --git a/tests/Doctrine/Tests/ORM/Hydration/SimpleObjectHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/SimpleObjectHydratorTest.php index 023d3e8518f..52c31272806 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/SimpleObjectHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/SimpleObjectHydratorTest.php @@ -36,7 +36,7 @@ public function testMissingDiscriminatorColumnException(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new SimpleObjectHydrator($this->_em); + $hydrator = new SimpleObjectHydrator($this->entityManager); $hydrator->hydrateAll($stmt, $rsm); } @@ -59,7 +59,7 @@ public function testExtraFieldInResultSetShouldBeIgnore(): void $expectedEntity->city = 'Cracow'; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new SimpleObjectHydrator($this->_em); + $hydrator = new SimpleObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals($result[0], $expectedEntity); } @@ -89,7 +89,7 @@ public function testInvalidDiscriminatorValueException(): void ]; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new SimpleObjectHydrator($this->_em); + $hydrator = new SimpleObjectHydrator($this->entityManager); $hydrator->hydrateAll($stmt, $rsm); } @@ -118,7 +118,7 @@ public function testNullValueShouldNotOverwriteFieldWithSameNameInJoinedInherita $expectedEntity->tags = ['tag1', 'tag2']; $stmt = new HydratorMockStatement($resultSet); - $hydrator = new SimpleObjectHydrator($this->_em); + $hydrator = new SimpleObjectHydrator($this->entityManager); $result = $hydrator->hydrateAll($stmt, $rsm); $this->assertEquals($result[0], $expectedEntity); } diff --git a/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php b/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php index 0d7dc1b380d..82d0b5161e9 100644 --- a/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php +++ b/tests/Doctrine/Tests/ORM/Hydration/SingleScalarHydratorTest.php @@ -66,7 +66,7 @@ public function testHydrateSingleScalar($name, $resultSet): void $rsm->addFieldResult('u', 'u__name', 'name'); $stmt = new HydratorMockStatement($resultSet); - $hydrator = new SingleScalarHydrator($this->_em); + $hydrator = new SingleScalarHydrator($this->entityManager); if ($name === 'result1') { $result = $hydrator->hydrateAll($stmt, $rsm); diff --git a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php index 015ac665c3a..58b2670cf5a 100644 --- a/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Id/AssignedGeneratorTest.php @@ -61,15 +61,28 @@ public function testCorrectIdGeneration(): void /** @Entity */ class AssignedSingleIdEntity { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ public $myId; } /** @Entity */ class AssignedCompositeIdEntity { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ public $myId1; - /** @Id @Column(type="integer") */ + + /** + * @var int + * @Id + * @Column(type="integer") + */ public $myId2; } diff --git a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php index 28b1a280557..be130235072 100644 --- a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php +++ b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php @@ -123,8 +123,6 @@ public function testDefersPostLoadOfEntityOnlyOnce(int $listenersFlag): void */ public function testDefersMultiplePostLoadOfEntity(int $listenersFlag): void { - /** @var ClassMetadata $metadata1 */ - /** @var ClassMetadata $metadata2 */ $metadata1 = $this->createMock(ClassMetadata::class); $metadata2 = $this->createMock(ClassMetadata::class); $entity1 = new stdClass(); @@ -179,7 +177,10 @@ public function testSkipsDeferredPostLoadOfMetadataWithNoInvokedListeners(): voi $this->handler->hydrationComplete(); } - public function invocationFlagProvider() + /** + * @psalm-return list + */ + public function invocationFlagProvider(): array { return [ [ListenersInvoker::INVOKE_LISTENERS], diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index a21e0e22715..d30d99f32da 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -243,18 +243,26 @@ class EntitySubClass extends TransientBaseClass /** @MappedSuperclass */ class MappedSuperclassBase { - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ private $mapped1; + /** * @var string * @Column(type="string") */ private $mapped2; + /** + * @var MappedSuperclassRelated1 * @OneToOne(targetEntity="MappedSuperclassRelated1") * @JoinColumn(name="related1_id", referencedColumnName="id") */ private $mappedRelated1; + + /** @var mixed */ private $transient; } class MappedSuperclassRelated1 @@ -264,8 +272,13 @@ class MappedSuperclassRelated1 /** @Entity */ class EntitySubClass2 extends MappedSuperclassBase { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ private $id; + /** * @var string * @Column(type="string") @@ -297,8 +310,13 @@ class MappedSuperclassBaseIndex /** @Entity @Table(uniqueConstraints={@UniqueConstraint(name="IDX_NAME_INDEX",columns={"name"})}) */ class EntityIndexSubClass extends MappedSuperclassBaseIndex { - /** @Id @Column(type="integer") */ + /** + * @var int + * @Id + * @Column(type="integer") + */ private $id; + /** * @var string * @Column(type="string") @@ -385,7 +403,10 @@ class SuperclassEntity extends SuperclassBase abstract class SuperclassBase { /** - * @Column(type="integer") @Id @GeneratedValue(strategy="SEQUENCE") + * @var int + * @Column(type="integer") + * @Id + * @GeneratedValue(strategy="SEQUENCE") * @SequenceGenerator(sequenceName="foo", initialValue=10) */ public $id; diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php index 4cd8434b25a..58898a89e9a 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataLoadEventTest.php @@ -44,12 +44,18 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void class LoadEventTestEntity { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ private $id; - /** @Column(type="string", length=255) */ + + /** + * @var string + * @Column(type="string", length=255) + */ private $name; + /** @var mixed */ private $about; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index b972d6bb443..dcead9095d1 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -1291,7 +1291,10 @@ public function testInlineEmbeddable(): void */ class DDC2700MappedSuperClass { - /** @Column */ + /** + * @var mixed + * @Column + */ private $foo; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php index 23e94563ab6..b6a6b1c1727 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/XmlMappingDriverTest.php @@ -23,9 +23,11 @@ use function array_filter; use function array_map; +use function assert; use function count; use function glob; use function in_array; +use function is_array; use function pathinfo; use const DIRECTORY_SEPARATOR; @@ -171,16 +173,20 @@ public function testValidateXmlSchema(string $xmlMappingFile): void $this->assertTrue($dom->schemaValidate($xsdSchemaFile)); } - public static function dataValidSchema() + /** + * @psalm-return list + */ + public static function dataValidSchema(): array { $list = glob(__DIR__ . '/xml/*.xml'); $invalid = ['Doctrine.Tests.Models.DDC889.DDC889Class.dcm']; + assert(is_array($list)); - $list = array_filter($list, static function ($item) use ($invalid) { + $list = array_filter($list, static function (string $item) use ($invalid): bool { return ! in_array(pathinfo($item, PATHINFO_FILENAME), $invalid); }); - return array_map(static function ($item) { + return array_map(static function (string $item) { return [$item]; }, $list); } @@ -229,6 +235,7 @@ public function testinvalidEntityOrMappedSuperClassShouldMentionParentClasses(): class CTI { + /** @var int */ public $id; } @@ -244,9 +251,12 @@ class CTIBaz extends CTI class XMLSLC { + /** @var mixed */ public $foo; } + class XMLSLCFoo { + /** @var int */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php index ce5a6e97b46..53df0578b22 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/YamlMappingDriverTest.php @@ -98,9 +98,12 @@ public function testDeprecation(): void class DDC2069Entity { + /** @var int */ public $id; + /** @var string */ public $name; + /** @var mixed */ public $value; } diff --git a/tests/Doctrine/Tests/ORM/Performance/SecondLevelCacheTest.php b/tests/Doctrine/Tests/ORM/Performance/SecondLevelCacheTest.php index 8ace5f185b6..3683395cf39 100644 --- a/tests/Doctrine/Tests/ORM/Performance/SecondLevelCacheTest.php +++ b/tests/Doctrine/Tests/ORM/Performance/SecondLevelCacheTest.php @@ -15,6 +15,7 @@ use function microtime; use function number_format; use function printf; +use function sprintf; use function str_repeat; use const PHP_EOL; @@ -127,7 +128,7 @@ public function testQueryEntityWithCache(): void $this->assertEquals(503, $this->countQuery($em)); } - private function queryEntity(EntityManagerInterface $em, $label): void + private function queryEntity(EntityManagerInterface $em, string $label): void { $times = 100; $size = 500; @@ -136,7 +137,7 @@ private function queryEntity(EntityManagerInterface $em, $label): void echo PHP_EOL . $label; for ($i = 0; $i < $size; $i++) { - $em->persist(new Country("Country $i")); + $em->persist(new Country(sprintf('Country %d', $i))); } $em->flush(); @@ -158,7 +159,7 @@ private function queryEntity(EntityManagerInterface $em, $label): void printf("\n%s\n", str_repeat('-', 50)); } - public function findEntityOneToMany(EntityManagerInterface $em, $label): void + public function findEntityOneToMany(EntityManagerInterface $em, string $label): void { $times = 50; $size = 30; @@ -173,7 +174,7 @@ public function findEntityOneToMany(EntityManagerInterface $em, $label): void $em->flush(); for ($i = 0; $i < $size / 2; $i++) { - $state = new State("State $i", $country); + $state = new State(sprintf('State %d', $i), $country); $em->persist($state); @@ -184,7 +185,7 @@ public function findEntityOneToMany(EntityManagerInterface $em, $label): void foreach ($states as $key => $state) { for ($i = 0; $i < $size; $i++) { - $city = new City("City $key - $i", $state); + $city = new City(sprintf('City %s - %d', $key, $i), $state); $em->persist($city); @@ -225,7 +226,7 @@ private function findEntity(EntityManagerInterface $em, $label): void echo PHP_EOL . $label; for ($i = 0; $i < $size; $i++) { - $country = new Country("Country $i"); + $country = new Country(sprintf('Country %d', $i)); $em->persist($country); @@ -250,7 +251,7 @@ private function findEntity(EntityManagerInterface $em, $label): void printf("\n%s\n", str_repeat('-', 50)); } - private function findAllEntity(EntityManagerInterface $em, $label): void + private function findAllEntity(EntityManagerInterface $em, string $label): void { $times = 100; $size = 50; @@ -260,7 +261,7 @@ private function findAllEntity(EntityManagerInterface $em, $label): void echo PHP_EOL . $label; for ($i = 0; $i < $size; $i++) { - $em->persist(new Country("Country $i")); + $em->persist(new Country(sprintf('Country %d', $i))); } $em->flush(); diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php index 1397b1ce33b..576a1abcfed 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeParametersTest.php @@ -15,22 +15,22 @@ class BasicEntityPersisterCompositeTypeParametersTest extends OrmTestCase { /** @var BasicEntityPersister */ - protected $_persister; + protected $persister; /** @var EntityManager */ - protected $_em; + protected $entityManager; protected function setUp(): void { parent::setUp(); - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); - $this->_em->getClassMetadata(Country::class); - $this->_em->getClassMetadata(Admin1::class); - $this->_em->getClassMetadata(Admin1AlternateName::class); + $this->entityManager->getClassMetadata(Country::class); + $this->entityManager->getClassMetadata(Admin1::class); + $this->entityManager->getClassMetadata(Admin1AlternateName::class); - $this->_persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(Admin1AlternateName::class)); + $this->persister = new BasicEntityPersister($this->entityManager, $this->entityManager->getClassMetadata(Admin1AlternateName::class)); } public function testExpandParametersWillExpandCompositeEntityKeys(): void @@ -38,7 +38,7 @@ public function testExpandParametersWillExpandCompositeEntityKeys(): void $country = new Country('IT', 'Italy'); $admin1 = new Admin1(10, 'Rome', $country); - [$values, $types] = $this->_persister->expandParameters(['admin1' => $admin1]); + [$values, $types] = $this->persister->expandParameters(['admin1' => $admin1]); $this->assertEquals(['integer', 'string'], $types); $this->assertEquals([10, 'IT'], $values); @@ -52,7 +52,7 @@ public function testExpandCriteriaParametersWillExpandCompositeEntityKeys(): voi $criteria = Criteria::create(); $criteria->andWhere(Criteria::expr()->eq('admin1', $admin1)); - [$values, $types] = $this->_persister->expandCriteriaParameters($criteria); + [$values, $types] = $this->persister->expandCriteriaParameters($criteria); $this->assertEquals(['integer', 'string'], $types); $this->assertEquals([10, 'IT'], $values); diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php index b59ede6eacc..d3c88654520 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterCompositeTypeSqlTest.php @@ -13,40 +13,40 @@ class BasicEntityPersisterCompositeTypeSqlTest extends OrmTestCase { /** @var BasicEntityPersister */ - protected $_persister; + protected $persister; /** @var EntityManager */ - protected $_em; + protected $entityManager; protected function setUp(): void { parent::setUp(); - $this->_em = $this->getTestEntityManager(); - $this->_persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(Admin1AlternateName::class)); + $this->entityManager = $this->getTestEntityManager(); + $this->persister = new BasicEntityPersister($this->entityManager, $this->entityManager->getClassMetadata(Admin1AlternateName::class)); } public function testSelectConditionStatementEq(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('admin1', 1, [], Comparison::EQ); + $statement = $this->persister->getSelectConditionStatementSQL('admin1', 1, [], Comparison::EQ); $this->assertEquals('t0.admin1 = ? AND t0.country = ?', $statement); } public function testSelectConditionStatementEqNull(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('admin1', null, [], Comparison::IS); + $statement = $this->persister->getSelectConditionStatementSQL('admin1', null, [], Comparison::IS); $this->assertEquals('t0.admin1 IS NULL AND t0.country IS NULL', $statement); } public function testSelectConditionStatementNeqNull(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('admin1', null, [], Comparison::NEQ); + $statement = $this->persister->getSelectConditionStatementSQL('admin1', null, [], Comparison::NEQ); $this->assertEquals('t0.admin1 IS NOT NULL AND t0.country IS NOT NULL', $statement); } public function testSelectConditionStatementIn(): void { $this->expectException('Doctrine\ORM\ORMException'); - $this->_persister->getSelectConditionStatementSQL('admin1', [], [], Comparison::IN); + $this->persister->getSelectConditionStatementSQL('admin1', [], [], Comparison::IN); } } diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index c6d0c6634eb..2daf5bce2ef 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -18,10 +18,10 @@ class BasicEntityPersisterTypeValueSqlTest extends OrmTestCase { /** @var BasicEntityPersister */ - protected $_persister; + protected $persister; /** @var EntityManager */ - protected $_em; + protected $entityManager; protected function setUp(): void { @@ -39,17 +39,17 @@ protected function setUp(): void DBALType::addType('upper_case_string', '\Doctrine\Tests\DbalTypes\UpperCaseStringType'); } - $this->_em = $this->getTestEntityManager(); + $this->entityManager = $this->getTestEntityManager(); - $this->_persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(CustomTypeParent::class)); + $this->persister = new BasicEntityPersister($this->entityManager, $this->entityManager->getClassMetadata(CustomTypeParent::class)); } public function testGetInsertSQLUsesTypeValuesSQL(): void { - $method = new ReflectionMethod($this->_persister, 'getInsertSQL'); + $method = new ReflectionMethod($this->persister, 'getInsertSQL'); $method->setAccessible(true); - $sql = $method->invoke($this->_persister); + $sql = $method->invoke($this->persister); $this->assertEquals('INSERT INTO customtype_parents (customInteger, child_id) VALUES (ABS(?), ?)', $sql); } @@ -62,25 +62,25 @@ public function testUpdateUsesTypeValuesSQL(): void $parent->customInteger = 1; $parent->child = $child; - $this->_em->getUnitOfWork()->registerManaged($parent, ['id' => 1], ['customInteger' => 0, 'child' => null]); - $this->_em->getUnitOfWork()->registerManaged($child, ['id' => 1], []); + $this->entityManager->getUnitOfWork()->registerManaged($parent, ['id' => 1], ['customInteger' => 0, 'child' => null]); + $this->entityManager->getUnitOfWork()->registerManaged($child, ['id' => 1], []); - $this->_em->getUnitOfWork()->propertyChanged($parent, 'customInteger', 0, 1); - $this->_em->getUnitOfWork()->propertyChanged($parent, 'child', null, $child); + $this->entityManager->getUnitOfWork()->propertyChanged($parent, 'customInteger', 0, 1); + $this->entityManager->getUnitOfWork()->propertyChanged($parent, 'child', null, $child); - $this->_persister->update($parent); + $this->persister->update($parent); - $executeUpdates = $this->_em->getConnection()->getExecuteUpdates(); + $executeUpdates = $this->entityManager->getConnection()->getExecuteUpdates(); $this->assertEquals('UPDATE customtype_parents SET customInteger = ABS(?), child_id = ? WHERE id = ?', $executeUpdates[0]['query']); } public function testGetSelectConditionSQLUsesTypeValuesSQL(): void { - $method = new ReflectionMethod($this->_persister, 'getSelectConditionSQL'); + $method = new ReflectionMethod($this->persister, 'getSelectConditionSQL'); $method->setAccessible(true); - $sql = $method->invoke($this->_persister, ['customInteger' => 1, 'child' => 1]); + $sql = $method->invoke($this->persister, ['customInteger' => 1, 'child' => 1]); $this->assertEquals('t0.customInteger = ABS(?) AND t0.child_id = ?', $sql); } @@ -90,7 +90,7 @@ public function testGetSelectConditionSQLUsesTypeValuesSQL(): void */ public function testStripNonAlphanumericCharactersFromSelectColumnListSQL(): void { - $persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(NonAlphaColumnsEntity::class)); + $persister = new BasicEntityPersister($this->entityManager, $this->entityManager->getClassMetadata(NonAlphaColumnsEntity::class)); $method = new ReflectionMethod($persister, 'getSelectColumnsSQL'); $method->setAccessible(true); @@ -102,19 +102,19 @@ public function testStripNonAlphanumericCharactersFromSelectColumnListSQL(): voi */ public function testSelectConditionStatementIsNull(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('test', null, [], Comparison::IS); + $statement = $this->persister->getSelectConditionStatementSQL('test', null, [], Comparison::IS); $this->assertEquals('test IS NULL', $statement); } public function testSelectConditionStatementEqNull(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('test', null, [], Comparison::EQ); + $statement = $this->persister->getSelectConditionStatementSQL('test', null, [], Comparison::EQ); $this->assertEquals('test IS NULL', $statement); } public function testSelectConditionStatementNeqNull(): void { - $statement = $this->_persister->getSelectConditionStatementSQL('test', null, [], Comparison::NEQ); + $statement = $this->persister->getSelectConditionStatementSQL('test', null, [], Comparison::NEQ); $this->assertEquals('test IS NOT NULL', $statement); } @@ -125,23 +125,23 @@ public function testSelectConditionStatementWithMultipleValuesContainingNull(): { $this->assertEquals( '(t0.id IN (?) OR t0.id IS NULL)', - $this->_persister->getSelectConditionStatementSQL('id', [null]) + $this->persister->getSelectConditionStatementSQL('id', [null]) ); $this->assertEquals( '(t0.id IN (?) OR t0.id IS NULL)', - $this->_persister->getSelectConditionStatementSQL('id', [null, 123]) + $this->persister->getSelectConditionStatementSQL('id', [null, 123]) ); $this->assertEquals( '(t0.id IN (?) OR t0.id IS NULL)', - $this->_persister->getSelectConditionStatementSQL('id', [123, null]) + $this->persister->getSelectConditionStatementSQL('id', [123, null]) ); } public function testCountCondition(): void { - $persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata(NonAlphaColumnsEntity::class)); + $persister = new BasicEntityPersister($this->entityManager, $this->entityManager->getClassMetadata(NonAlphaColumnsEntity::class)); // Using a criteria as array $statement = $persister->getCountSQL(['value' => 'bar']); @@ -155,6 +155,6 @@ public function testCountCondition(): void public function testCountEntities(): void { - $this->assertEquals(0, $this->_persister->count()); + $this->assertEquals(0, $this->persister->count()); } } diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php index 9a42cda11be..f4dd6a12e29 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersJoinTest.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Query; +use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsUser; @@ -17,6 +18,7 @@ */ class CustomTreeWalkersJoinTest extends OrmTestCase { + /** @var EntityManagerInterface */ private $em; protected function setUp(): void @@ -24,7 +26,7 @@ protected function setUp(): void $this->em = $this->getTestEntityManager(); } - public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed): void + public function assertSqlGeneration(string $dqlToBeTested, string $sqlToBeConfirmed): void { try { $query = $this->em->createQuery($dqlToBeTested); diff --git a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php index 64729cc062a..95332788e6b 100644 --- a/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php +++ b/tests/Doctrine/Tests/ORM/Query/CustomTreeWalkersTest.php @@ -7,6 +7,8 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\Query\QueryException; +use Doctrine\ORM\Query\SqlWalker; +use Doctrine\ORM\Query\TreeWalker; use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\OrmTestCase; @@ -30,7 +32,11 @@ protected function setUp(): void $this->entityManager = $this->getTestEntityManager(); } - public function generateSql($dqlToBeTested, $treeWalkers, $outputWalker) + /** + * @param list> $treeWalkers + * @param class-string|null $outputWalker + */ + public function generateSql(string $dqlToBeTested, array $treeWalkers, ?string $outputWalker): string { $query = $this->entityManager->createQuery($dqlToBeTested); $query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, $treeWalkers) @@ -43,8 +49,16 @@ public function generateSql($dqlToBeTested, $treeWalkers, $outputWalker) return $query->getSql(); } - public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed, $treeWalkers = [], $outputWalker = null): void - { + /** + * @param list> $treeWalkers + * @param class-string|null $outputWalker + */ + public function assertSqlGeneration( + string $dqlToBeTested, + string $sqlToBeConfirmed, + array $treeWalkers = [], + ?string $outputWalker = null + ): void { try { $this->assertEquals($sqlToBeConfirmed, $this->generateSql($dqlToBeTested, $treeWalkers, $outputWalker)); } catch (Exception $e) { @@ -140,7 +154,8 @@ public function walkSelectStatement(Query\AST\SelectStatement $selectStatement): $factors[] = $factor; } - if (($whereClause = $selectStatement->whereClause) !== null) { + $whereClause = $selectStatement->whereClause; + if ($whereClause !== null) { // There is already a WHERE clause, so append the conditions $condExpr = $whereClause->conditionalExpression; From 7312ddeda7ddb23e0aa0396f99e239be96eb02fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 12 Feb 2021 23:09:04 +0100 Subject: [PATCH 14/27] Manually fix cs --- .../Models/DDC117/DDC117ApproveChanges.php | 7 +++- .../Tests/Models/DDC117/DDC117Editor.php | 7 +++- .../DirectoryTree/AbstractContentItem.php | 7 +++- tests/Doctrine/Tests/Models/Quote/Address.php | 6 ++-- .../Functional/ClassTableInheritanceTest2.php | 7 +++- .../Tests/ORM/Functional/NotifyPolicyTest.php | 14 ++++++-- .../Functional/OneToOneEagerLoadingTest.php | 14 ++++++-- .../ORM/Functional/SchemaTool/DBAL483Test.php | 7 +++- .../ORM/Functional/Ticket/DDC1151Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC1181Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC1452Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC1514Test.php | 21 +++++++++-- .../ORM/Functional/Ticket/DDC1515Test.php | 7 +++- .../ORM/Functional/Ticket/DDC1654Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC1690Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC1707Test.php | 7 +++- .../ORM/Functional/Ticket/DDC1998Test.php | 5 ++- .../ORM/Functional/Ticket/DDC199Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2231Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2306Test.php | 28 ++++++++++++--- .../ORM/Functional/Ticket/DDC2346Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC2350Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC2359Test.php | 7 +++- .../ORM/Functional/Ticket/DDC237Test.php | 21 +++++++++-- .../ORM/Functional/Ticket/DDC2579Test.php | 5 ++- .../ORM/Functional/Ticket/DDC2660Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC2692Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2759Test.php | 28 ++++++++++++--- .../ORM/Functional/Ticket/DDC2780Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC3042Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC3170Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC3223Test.php | 7 +++- .../ORM/Functional/Ticket/DDC371Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC381Test.php | 7 +++- .../ORM/Functional/Ticket/DDC422Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC522Test.php | 21 +++++++++-- .../ORM/Functional/Ticket/DDC5684Test.php | 6 ++++ .../ORM/Functional/Ticket/DDC633Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC656Test.php | 7 +++- .../ORM/Functional/Ticket/DDC735Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC832Test.php | 14 ++++++-- .../ORM/Functional/Ticket/GH6029Test.php | 35 ++++++++++++++++--- .../ORM/Functional/Ticket/GH6141Test.php | 3 +- .../ORM/Functional/Ticket/GH6217Test.php | 21 +++++++++-- .../ORM/Functional/Ticket/GH6362Test.php | 24 ++++++++++--- .../ORM/Functional/Ticket/GH6402Test.php | 4 +-- .../ORM/Functional/Ticket/GH6464Test.php | 19 ++++++++-- .../ORM/Functional/Ticket/GH6937Test.php | 7 +++- .../ORM/Functional/Ticket/GH7012Test.php | 6 +++- .../ORM/Functional/Ticket/GH7068Test.php | 7 +++- .../ORM/Functional/Ticket/GH7079Test.php | 8 ++++- .../ORM/Functional/Ticket/GH7366Test.php | 1 + .../Ticket/GH7496WithToIterableTest.php | 5 +++ .../ORM/Functional/Ticket/GH7505Test.php | 6 ++-- .../ORM/Functional/Ticket/GH7629Test.php | 1 + .../ORM/Functional/Ticket/GH7735Test.php | 1 + .../ORM/Functional/Ticket/GH7737Test.php | 9 ++++- .../ORM/Functional/Ticket/GH7761Test.php | 4 +++ .../ORM/Functional/Ticket/GH7767Test.php | 20 ++++++++--- .../ORM/Functional/Ticket/GH7820Test.php | 6 ++++ .../Mapping/BasicInheritanceMappingTest.php | 1 + 61 files changed, 579 insertions(+), 100 deletions(-) diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php b/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php index 8a7fe7ce73f..5def2d0ff5d 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php @@ -9,7 +9,12 @@ */ class DDC117ApproveChanges { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php b/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php index 0904f8cd916..f7cb81cf192 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117Editor.php @@ -11,7 +11,12 @@ */ class DDC117Editor { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** diff --git a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php index 259f935954a..3beb89a4f30 100644 --- a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php +++ b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php @@ -9,7 +9,12 @@ */ abstract class AbstractContentItem { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @ManyToOne(targetEntity="Directory") */ diff --git a/tests/Doctrine/Tests/Models/Quote/Address.php b/tests/Doctrine/Tests/Models/Quote/Address.php index 0105134d051..3588815ca7d 100644 --- a/tests/Doctrine/Tests/Models/Quote/Address.php +++ b/tests/Doctrine/Tests/Models/Quote/Address.php @@ -14,6 +14,7 @@ class Address { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="`address-id`") @@ -24,6 +25,7 @@ class Address public $zip; /** + * @var User * @OneToOne(targetEntity="User", inversedBy="address") * @JoinColumn(name="`user-id`", referencedColumnName="`user-id`") */ @@ -37,7 +39,7 @@ public function setUser(User $user): void } } - public function getId() + public function getId(): int { return $this->id; } @@ -47,7 +49,7 @@ public function getZip() return $this->zip; } - public function getUser() + public function getUser(): User { return $this->user; } diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index fbb5e088fe0..f7af8e5362e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -172,7 +172,12 @@ public function setCTIParent($ctiParent): void /** @Entity */ class CTIRelated2 { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @ManyToMany(targetEntity="CTIChild") */ private $ctiChildren; diff --git a/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php b/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php index 2290e0d06c6..3fb1ae99c20 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php @@ -115,7 +115,12 @@ protected function onPropertyChanged($propName, $oldValue, $newValue): void /** @Entity @ChangeTrackingPolicy("NOTIFY") */ class NotifyUser extends NotifyBaseEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @Column */ @@ -154,7 +159,12 @@ public function getGroups() /** @Entity */ class NotifyGroup extends NotifyBaseEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @Column */ diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php index 4c3e43a976c..16597c13e27 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php @@ -290,7 +290,12 @@ public function addWaggon(Waggon $w): void */ class TrainDriver { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @column(type="string") */ public $name; @@ -317,7 +322,12 @@ public function setTrain(Train $t): void */ class TrainOwner { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @column(type="string") */ public $name; diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php index c1b3f969628..03cd246c9a9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php @@ -46,7 +46,12 @@ public function testDefaultValueIsComparedCorrectly(): void */ class DBAL483Default { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column(type="integer", options={"default": 0}) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php index cddf140f813..0578d42f9a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php @@ -42,7 +42,12 @@ public function testQuoteForeignKey(): void */ class DDC1151User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToMany(targetEntity="DDC1151Group") */ @@ -55,6 +60,11 @@ class DDC1151User */ class DDC1151Group { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php index 1391ad0e134..f6f86ba1658 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1181Test.php @@ -59,7 +59,12 @@ public function testIssue(): void */ class DDC1181Hotel { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -99,6 +104,11 @@ class DDC1181Booking */ class DDC1181Room { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php index 67a073b94c8..d1ac1490149 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php @@ -97,7 +97,12 @@ public function testFetchJoinOneToOneFromInverse(): void */ class DDC1452EntityA { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column */ public $title; @@ -120,7 +125,12 @@ public function getEntitiesB() */ class DDC1452EntityB { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC1452EntityA", inversedBy="entitiesB") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php index 20273dffd50..3a202bf9b6a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php @@ -73,7 +73,12 @@ public function testIssue(): void */ class DDC1514EntityA { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column */ public $title; @@ -93,7 +98,12 @@ public function __construct() */ class DDC1514EntityB { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB") */ @@ -107,7 +117,12 @@ class DDC1514EntityB */ class DDC1514EntityC { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column */ public $title; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php index 44bd3a54556..b032f9848d2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php @@ -53,7 +53,12 @@ class DDC1515Foo */ class DDC1515Bar { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToOne(targetEntity="DDC1515Foo", mappedBy="bar") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1654Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1654Test.php index 628137de2f4..e0e05c24a1e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1654Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1654Test.php @@ -140,7 +140,12 @@ public function testManyToManyClearCollectionReAddOrphanRemoval(): void */ class DDC1654Post { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -155,6 +160,11 @@ class DDC1654Post */ class DDC1654Comment { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php index fa098f24ab6..b9fce721d5f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php @@ -105,7 +105,12 @@ protected function onPropertyChanged($propName, $oldValue, $newValue): void /** @Entity @ChangeTrackingPolicy("NOTIFY") */ class DDC1690Parent extends NotifyBaseEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @Column */ @@ -144,7 +149,12 @@ public function getChild() /** @Entity */ class DDC1690Child extends NotifyBaseEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** @Column */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php index 65e34fb1033..55f8c98cb5f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1707Test.php @@ -47,7 +47,12 @@ public function testPostLoadOnChild(): void */ abstract class DDC1707Base { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ protected $id; public $postLoad = false; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php index 5de93d0f189..24782a2deab 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php @@ -74,7 +74,10 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) return (string) $value; } - public function convertToPhpValue($value, AbstractPlatform $platform) + /** + * {@inheritDoc} + */ + public function convertToPHPValue($value, AbstractPlatform $platform) { return new DDC1998Id($value); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index 0f8eaa6ee7c..6b9a9f7fbfa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -90,7 +90,12 @@ class DDC199ChildClass extends DDC199ParentClass /** @Entity @Table(name="ddc199_relatedclass") */ class DDC199RelatedClass { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column */ public $relatedData; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php index 11e819aef49..d7853bd2a52 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2231Test.php @@ -52,7 +52,12 @@ public function testInjectObjectManagerInProxyIfInitializedInUow(): void /** @Entity @Table(name="ddc2231_y") */ class DDC2231EntityY implements ObjectManagerAware { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; public $om; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php index 30085fe8ddb..f1b2b6bed14 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php @@ -83,7 +83,12 @@ public function testIssue(): void /** @Entity */ class DDC2306Zone { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -92,7 +97,12 @@ class DDC2306Zone */ class DDC2306User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -114,7 +124,12 @@ public function __construct() /** @Entity */ class DDC2306Address { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -136,7 +151,12 @@ public function __construct() /** @Entity */ class DDC2306UserAddress { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC2306User") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php index 80c800ec2b6..250e05c2958 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php @@ -69,7 +69,12 @@ public function testIssue(): void /** @Entity */ class DDC2346Foo { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -93,7 +98,12 @@ public function __construct() */ class DDC2346Bar { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC2346Foo", inversedBy="bars", fetch="EAGER") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php index ed7b13c897b..d8dc0c553c7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php @@ -57,7 +57,12 @@ public function testEagerCollectionsAreOnlyRetrievedOnce(): void */ class DDC2350User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToMany(targetEntity="DDC2350Bug", mappedBy="user", fetch="EAGER") */ public $reportedBugs; @@ -68,7 +73,12 @@ class DDC2350User */ class DDC2350Bug { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC2350User", inversedBy="reportedBugs") */ public $user; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php index 5dfd43f2a1d..73f8567df5e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php @@ -66,6 +66,11 @@ public function testIssue(): void /** @Entity */ class DDC2359Foo { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index 11468c9cfeb..251699d0db9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -73,7 +73,12 @@ public function testUninitializedProxyIsInitializedOnFetchJoin(): void */ class DDC237EntityX { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** * @var string @@ -91,7 +96,12 @@ class DDC237EntityX /** @Entity @Table(name="ddc237_y") */ class DDC237EntityY { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** * @var string @@ -103,7 +113,12 @@ class DDC237EntityY /** @Entity @Table(name="ddc237_z") */ class DDC237EntityZ { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** * @var string diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php index ea42947a6ca..4709a8863e5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php @@ -142,7 +142,10 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) return (string) $value; } - public function convertToPhpValue($value, AbstractPlatform $platform) + /** + * {@inheritDoc} + */ + public function convertToPHPValue($value, AbstractPlatform $platform) { return new DDC2579Id($value); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php index 9383380ffc2..edd8fd5819d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2660Test.php @@ -86,14 +86,24 @@ public function testIssueWithoutExtraColumn(): void */ class DDC2660Product { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } /** @Entity @Table(name="ddc_2660_customer") */ class DDC2660Customer { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php index b20d0e5483c..98b5eb0d543 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2692Test.php @@ -54,7 +54,12 @@ public function testIsListenerCalledOnlyOnceOnPreFlush(): void */ class DDC2692Foo { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php index e567ec081d6..e6a62b5a599 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php @@ -70,7 +70,12 @@ public function testCorrectNumberOfAssociationsIsReturned(): void /** @Entity @Table(name="ddc_2759_qualification") */ class DDC2759Qualification { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToOne(targetEntity="DDC2759QualificationMetadata", mappedBy="content") */ @@ -80,7 +85,12 @@ class DDC2759Qualification /** @Entity @Table(name="ddc_2759_category") */ class DDC2759Category { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToMany(targetEntity="DDC2759MetadataCategory", mappedBy="category") */ @@ -90,7 +100,12 @@ class DDC2759Category /** @Entity @Table(name="ddc_2759_qualification_metadata") */ class DDC2759QualificationMetadata { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToOne(targetEntity="DDC2759Qualification", inversedBy="metadata") */ @@ -108,7 +123,12 @@ public function __construct(DDC2759Qualification $content) /** @Entity @Table(name="ddc_2759_metadata_category") */ class DDC2759MetadataCategory { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="DDC2759QualificationMetadata", inversedBy="metadataCategories") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2780Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2780Test.php index c207d69cf2a..730037485eb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2780Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2780Test.php @@ -56,7 +56,12 @@ public function testIssue(): void */ class DDC2780User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -69,7 +74,12 @@ class DDC2780User /** @Entity */ class DDC2780Project { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php index 78cbf748478..9d1f09c5d3c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php @@ -42,7 +42,12 @@ public function testSQLGenerationDoesNotProvokeAliasCollisions(): void */ class DDC3042Foo { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $field; /** @Column(type="integer") */ public $field1; @@ -71,6 +76,11 @@ class DDC3042Foo */ class DDC3042Bar { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $field; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php index 410cd4b6f11..e2b3d395177 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3170Test.php @@ -73,7 +73,12 @@ public function testIssue(): void */ abstract class DDC3170AbstractEntityJoined { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -92,7 +97,12 @@ class DDC3170ProductJoined extends DDC3170AbstractEntityJoined */ abstract class DDC3170AbstractEntitySingleTable { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php index 5848913e509..8d2a8f50764 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php @@ -61,7 +61,12 @@ class Journalist extends Participant */ class Participant { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToOne(targetEntity="ProfileStatus") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php index 555845f361e..adad584e60a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php @@ -61,7 +61,12 @@ public function testIssue(): void /** @Entity */ class DDC371Child { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** * @var string @@ -75,7 +80,12 @@ class DDC371Child /** @Entity */ class DDC371Parent { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ private $id; /** * @var string diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php index 5e68818f3a7..115e4b8bb5b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php @@ -52,7 +52,12 @@ public function testCallUnserializedProxyMethods(): void */ class DDC381Entity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ protected $id; public function getId() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php index 0cf98532e78..97275200bd4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php @@ -57,7 +57,12 @@ public function testIssue(): void */ class DDC422Guest { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } @@ -82,6 +87,11 @@ public function __construct() /** @Entity */ class DDC422Contact { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index 7f501f9654b..cfb9778e110 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -95,7 +95,12 @@ public function testJoinColumnWithNullSameNameAssociationField(): void /** @Entity */ class DDC522Customer { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column */ @@ -108,7 +113,12 @@ class DDC522Customer /** @Entity */ class DDC522Cart { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column(type="integer") */ @@ -124,7 +134,12 @@ class DDC522Cart /** @Entity */ class DDC522ForeignKeyTest { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @Column(type="integer", name="cart_id", nullable=true) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php index f0b42660bcd..c7b1daf9427 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php @@ -63,11 +63,17 @@ public function testFetchObjectWithAutoIncrementedCustomType(): void class DDC5684ObjectIdType extends DBALTypes\IntegerType { + /** + * {@inheritDoc} + */ public function convertToPHPValue($value, AbstractPlatform $platform) { return new DDC5684ObjectId($value); } + /** + * {@inheritDoc} + */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { return $value->value; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php index 1e8160fdd84..5e2a147686c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php @@ -81,7 +81,12 @@ public function testDQLDeferredEagerLoad(): void */ class DDC633Appointment { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToOne(targetEntity="DDC633Patient", inversedBy="appointment", fetch="EAGER") */ @@ -93,7 +98,12 @@ class DDC633Appointment */ class DDC633Patient { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToOne(targetEntity="DDC633Appointment", mappedBy="patient") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php index 104914d3e14..1327af432bb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php @@ -66,7 +66,12 @@ class DDC656Entity */ public $type; - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $specificationId; public function getName() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php index 97465e49651..6564f3ceadf 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php @@ -63,7 +63,12 @@ public function testRemoveElementAppliesOrphanRemoval(): void */ class DDC735Product { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ protected $id; /** @@ -102,7 +107,12 @@ public function removeReview(DDC735Review $review): void */ class DDC735Review { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ protected $id; /** @ManyToOne(targetEntity="DDC735Product", inversedBy="reviews") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php index e3fff4765d0..e631add8dea 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php @@ -155,7 +155,12 @@ public function testQuotedTableJoinedChildRemove(): void */ class DDC832Like { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @@ -185,7 +190,12 @@ public function __construct($word) */ class DDC832JoinedIndex { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php index 37791b9672e..07bf54bd1b8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php @@ -81,7 +81,12 @@ public function testOneToManyAssociation(): void /** @Entity */ class GH6029User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @ManyToMany(targetEntity=GH6029Group::class, cascade={"all"}) */ @@ -96,21 +101,36 @@ public function __construct() /** @Entity */ class GH6029Group { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } /** @Entity */ class GH6029Group2 { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } /** @Entity */ class GH6029Product { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** @OneToMany(targetEntity=GH6029Feature::class, mappedBy="product", cascade={"all"}) */ @@ -125,7 +145,12 @@ public function __construct() /** @Entity */ class GH6029Feature { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php index 36c5f9b93e0..23990cbc4b8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6141Test.php @@ -90,7 +90,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) /** * {@inheritdoc} */ - public function convertToPhpValue($value, AbstractPlatform $platform) + public function convertToPHPValue($value, AbstractPlatform $platform) { return GH6141People::get($value); } @@ -157,6 +157,7 @@ public function __toString(): string abstract class GH6141Person { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6217Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6217Test.php index 1995c49f1a0..77e9ae719e0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6217Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6217Test.php @@ -57,7 +57,12 @@ public function testLoadingOfSecondLevelCacheOnEagerAssociations(): void /** @Entity @Cache(usage="NONSTRICT_READ_WRITE") */ class GH6217AssociatedEntity { - /** @Id @Column(type="string") @GeneratedValue(strategy="NONE") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="NONE") + */ public $id; public function __construct() @@ -69,10 +74,20 @@ public function __construct() /** @Entity @Cache(usage="NONSTRICT_READ_WRITE") */ class GH6217FetchedEntity { - /** @Id @Cache("NONSTRICT_READ_WRITE") @ManyToOne(targetEntity=GH6217AssociatedEntity::class) */ + /** + * @var GH6217AssociatedEntity + * @Id + * @Cache("NONSTRICT_READ_WRITE") + * @ManyToOne(targetEntity=GH6217AssociatedEntity::class) + */ public $lazy; - /** @Id @Cache("NONSTRICT_READ_WRITE") @ManyToOne(targetEntity=GH6217AssociatedEntity::class, fetch="EAGER") */ + /** + * @var GH6217AssociatedEntity + * @Id + * @Cache("NONSTRICT_READ_WRITE") + * @ManyToOne(targetEntity=GH6217AssociatedEntity::class, fetch="EAGER") + */ public $eager; public function __construct(GH6217AssociatedEntity $lazy, GH6217AssociatedEntity $eager) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php index be8ff37dcd5..7fb7881855a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6362Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Internal\Hydration\ObjectHydrator; use Doctrine\ORM\Query; use Doctrine\ORM\Query\ResultSetMapping; @@ -84,13 +85,17 @@ public function testInheritanceJoinAlias(): void class GH6362Start { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue */ protected $id; - /** @ManyToOne(targetEntity="GH6362Base", inversedBy="starts") */ + /** + * @var GH6362Base + * @ManyToOne(targetEntity="GH6362Base", inversedBy="starts") + */ private $bases; } @@ -103,13 +108,17 @@ class GH6362Start abstract class GH6362Base { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue */ protected $id; - /** @OneToMany(targetEntity="GH6362Start", mappedBy="bases") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="GH6362Start", mappedBy="bases") + */ private $starts; } @@ -118,7 +127,10 @@ abstract class GH6362Base */ class GH6362Child extends GH6362Base { - /** @OneToMany(targetEntity="GH6362Join", mappedBy="child") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="GH6362Join", mappedBy="child") + */ private $joins; } @@ -128,12 +140,16 @@ class GH6362Child extends GH6362Base class GH6362Join { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue */ private $id; - /** @ManyToOne(targetEntity="GH6362Child", inversedBy="joins") */ + /** + * @var GH6362Child + * @ManyToOne(targetEntity="GH6362Child", inversedBy="joins") + */ private $child; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php index 7db1a07b3f3..5a925bcde00 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6402Test.php @@ -62,7 +62,7 @@ public function testQueryWithSubClass(): void self::assertNotNull($addresses[0]->user); } - private function createAddress() + private function createAddress(): int { $address = new Address(); $address->zip = 'bar'; @@ -72,7 +72,7 @@ private function createAddress() return $address->id; } - private function createFullAddress() + private function createFullAddress(): int { $address = new FullAddress(); $address->zip = 'bar'; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6464Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6464Test.php index f5a682d05d1..186639c5c31 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6464Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6464Test.php @@ -50,10 +50,18 @@ public function testIssue(): void /** @Entity */ class GH6464Post { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $authorId; } @@ -65,7 +73,12 @@ class GH6464Post */ abstract class GH6464User { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php index 8099ac9698f..325f03a85bc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6937Test.php @@ -92,7 +92,12 @@ public function testPhoneNumberIsPopulatedWithQueryBuilder(): void */ abstract class GH6937Person { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php index 77de7b100dc..f0b63ecd34c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7012Test.php @@ -65,13 +65,17 @@ public function testUpdateEntityWithIdentifierAssociationWithQuotedJoinColumn(): class GH7012UserData { /** + * @var QuotedUser * @Id * @OneToOne(targetEntity=Doctrine\Tests\Models\Quote\User::class) * @JoinColumn(name="`user-id`", referencedColumnName="`user-id`", onDelete="CASCADE") */ public $user; - /** @Column(type="string", name="`name`") */ + /** + * @var string + * @Column(type="string", name="`name`") + */ public $name; public function __construct(QuotedUser $user, string $name) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7068Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7068Test.php index 594571a785e..4d0796c8ece 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7068Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7068Test.php @@ -38,6 +38,11 @@ public function testLockModeIsRespected(): void /** @Entity */ final class SomeEntity { - /** @Id @Column(type="integer") @GeneratedValue */ + /** + * @var int + * @Id + * @Column(type="integer") + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7079Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7079Test.php index 77136c9977e..609c4e17822 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7079Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7079Test.php @@ -91,12 +91,16 @@ private function createClassMetadata(string $className): ClassMetadata class GH7079CmsUser { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ public $id; - /** @OneToOne(targetEntity=GH7079CmsAddress::class, mappedBy="user", cascade={"persist"}, orphanRemoval=true) */ + /** + * @var GH7079CmsAddress + * @OneToOne(targetEntity=GH7079CmsAddress::class, mappedBy="user", cascade={"persist"}, orphanRemoval=true) + */ public $address; } @@ -107,12 +111,14 @@ class GH7079CmsUser class GH7079CmsAddress { /** + * @var int * @Column(type="integer") * @Id @GeneratedValue */ public $id; /** + * @var GH7079CmsUser * @OneToOne(targetEntity=GH7079CmsUser::class, inversedBy="address") * @JoinColumn(referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7366Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7366Test.php index 1b14467e73d..398650991a1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7366Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7366Test.php @@ -51,6 +51,7 @@ class GH7366Entity public $id; /** + * @var int * @Column(type="integer") * @Version */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php index 1d91b41f359..a43aa608b7c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php @@ -53,6 +53,7 @@ public function testNonUniqueObjectHydrationDuringIteration(): void class GH7496EntityA { /** + * @var int * @Id * @Column(type="integer", name="a_id") */ @@ -77,6 +78,7 @@ public function __construct(int $id, string $name) class GH7496EntityB { /** + * @var int * @Id * @Column(type="integer", name="b_id") */ @@ -101,18 +103,21 @@ public function __construct(int $id, $name) class GH7496EntityAinB { /** + * @var int * @Id * @Column(type="integer") */ public $id; /** + * @var GH7496EntityA * @ManyToOne(targetEntity=GH7496EntityA::class) * @JoinColumn(name="a_id", referencedColumnName="a_id", nullable=false) */ public $eA; /** + * @var GH7496EntityB * @ManyToOne(targetEntity=GH7496EntityB::class) * @JoinColumn(name="b_id", referencedColumnName="b_id", nullable=false) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7505Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7505Test.php index 973b476fcd8..8fb1d21b162 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7505Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7505Test.php @@ -60,7 +60,9 @@ public function testSimpleArrayTypeHydratedCorrectly(): void abstract class GH7505AbstractResponse { /** - * @Id @GeneratedValue + * @var int + * @Id + * @GeneratedValue * @Column(type="integer") */ public $id; @@ -72,8 +74,8 @@ abstract class GH7505AbstractResponse class GH7505ArrayResponse extends GH7505AbstractResponse { /** + * @var mixed[] * @Column(name="value_array", type="simple_array") - * @var array */ public $value = []; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7629Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7629Test.php index 3ae31f14f85..e56d65a9108 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7629Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7629Test.php @@ -53,6 +53,7 @@ public function testPersistAfterRemoveSchedulesForSynchronization(): void class GH7629Entity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7735Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7735Test.php index 44a5592c9aa..60b400ed99d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7735Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7735Test.php @@ -139,6 +139,7 @@ public function getModel(): string class GH7735Power { /** + * @var int * @Id * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7737Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7737Test.php index 16983a976d6..f7e1686ba26 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7737Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7737Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\Tests\OrmFunctionalTestCase; @@ -60,12 +61,16 @@ public function memberOfCriteriaShouldBeCompatibleWithQueryBuilder(): void class GH7737Group { /** + * @var int * @Id * @Column(type="integer") */ public $id; - /** @Column */ + /** + * @var string + * @Column + */ public $name; public function __construct(int $id, string $name) @@ -81,12 +86,14 @@ public function __construct(int $id, string $name) class GH7737Person { /** + * @var int * @Id * @Column(type="integer") */ public $id; /** + * @var Collection * @ManyToMany(targetEntity=GH7737Group::class) * @JoinTable(inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id", unique=true)}) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7761Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7761Test.php index 36b18ec4bc0..c6e7deb0632 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7761Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7761Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use function assert; @@ -69,6 +70,7 @@ public function testCollectionClearDoesClearIfPersisted(): void class GH7761Entity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -76,6 +78,7 @@ class GH7761Entity public $id; /** + * @var Collection * @ManyToMany(targetEntity="Doctrine\Tests\ORM\Functional\Ticket\GH7761ChildEntity", cascade={"all"}) * @JoinTable(name="gh7761_to_child", * joinColumns={@JoinColumn(name="entity_id")}, @@ -97,6 +100,7 @@ public function __construct() class GH7761ChildEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7767Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7767Test.php index e760ca7edf9..49f56ad82af 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7767Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7767Test.php @@ -4,8 +4,8 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; -use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\OrmFunctionalTestCase; use function assert; @@ -62,6 +62,7 @@ public function testMatchingOverrulesCollectionOrdering(): void class GH7767ParentEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -69,6 +70,7 @@ class GH7767ParentEntity private $id; /** + * @psalm-var Collection * @OneToMany(targetEntity=GH7767ChildEntity::class, mappedBy="parent", fetch="EXTRA_LAZY", cascade={"persist"}) * @OrderBy({"position" = "ASC"}) */ @@ -79,7 +81,10 @@ public function addChild(int $position): void $this->children[] = new GH7767ChildEntity($this, $position); } - public function getChildren(): PersistentCollection + /** + * @psalm-return Collection + */ + public function getChildren(): Collection { return $this->children; } @@ -91,16 +96,23 @@ public function getChildren(): PersistentCollection class GH7767ChildEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue */ private $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $position; - /** @ManyToOne(targetEntity=GH7767ParentEntity::class, inversedBy="children") */ + /** + * @var GH7767ParentEntity + * @ManyToOne(targetEntity=GH7767ParentEntity::class, inversedBy="children") + */ private $parent; public function __construct(GH7767ParentEntity $parent, int $position) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7820Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7820Test.php index 3b765321952..ccc2277d515 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7820Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7820Test.php @@ -172,6 +172,9 @@ public function __toString(): string final class GH7820LineTextType extends StringType { + /** + * {@inheritDoc} + */ public function convertToPHPValue($value, AbstractPlatform $platform) { $text = parent::convertToPHPValue($value, $platform); @@ -183,6 +186,9 @@ public function convertToPHPValue($value, AbstractPlatform $platform) return GH7820LineText::fromText($text); } + /** + * {@inheritDoc} + */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (! $value instanceof GH7820LineText) { diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index d30d99f32da..dc8b12780d8 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -265,6 +265,7 @@ class MappedSuperclassBase /** @var mixed */ private $transient; } + class MappedSuperclassRelated1 { } From b6fd4b5ef3bc66b1eaad33516e845488ebf876f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 13 Feb 2021 19:37:07 +0100 Subject: [PATCH 15/27] Automatically fix cs --- .../Doctrine/Tests/Models/CMS/CmsComment.php | 5 ++- .../Doctrine/Tests/Models/CMS/CmsEmployee.php | 1 + tests/Doctrine/Tests/Models/CMS/CmsTag.php | 1 + tests/Doctrine/Tests/Models/Cache/Address.php | 1 + .../Tests/Models/Cache/Attraction.php | 1 + .../Tests/Models/Cache/AttractionInfo.php | 1 + tests/Doctrine/Tests/Models/Cache/City.php | 1 + tests/Doctrine/Tests/Models/Cache/Client.php | 1 + tests/Doctrine/Tests/Models/Cache/Country.php | 1 + tests/Doctrine/Tests/Models/Cache/Login.php | 1 + tests/Doctrine/Tests/Models/Cache/Person.php | 1 + tests/Doctrine/Tests/Models/Cache/State.php | 1 + tests/Doctrine/Tests/Models/Cache/Travel.php | 1 + .../Doctrine/Tests/Models/Cache/Traveler.php | 1 + .../Tests/Models/Cache/TravelerProfile.php | 1 + .../Models/Cache/TravelerProfileInfo.php | 1 + .../Tests/Models/Company/CompanyCar.php | 5 ++- .../Tests/Models/Company/CompanyEmployee.php | 5 ++- .../Tests/Models/Company/CompanyManager.php | 5 ++- .../Tests/Models/DDC1590/DDC1590Entity.php | 1 + .../Tests/Models/DDC1590/DDC1590User.php | 5 ++- .../Tests/Models/DDC2372/DDC2372Address.php | 5 ++- .../Tests/Models/DDC2372/DDC2372User.php | 5 ++- .../Tests/Models/DDC3231/DDC3231User1.php | 6 +++- .../DDC3231/DDC3231User1NoNamespace.php | 6 +++- .../Tests/Models/DDC3231/DDC3231User2.php | 6 +++- .../DDC3231/DDC3231User2NoNamespace.php | 6 +++- .../Tests/Models/DDC3579/DDC3579User.php | 1 + .../Models/DDC3699/DDC3699RelationMany.php | 5 ++- .../Tests/Models/DDC3899/DDC3899Contract.php | 5 ++- .../Tests/Models/DDC4006/DDC4006UserId.php | 1 + .../DDC753EntityWithCustomRepository.php | 1 + ...DC753EntityWithDefaultCustomRepository.php | 1 + .../DDC753EntityWithInvalidRepository.php | 1 + .../Tests/Models/DDC869/DDC869Payment.php | 1 + .../Tests/Models/DDC889/DDC889Class.php | 1 + .../Tests/Models/DDC964/DDC964User.php | 1 + .../DirectoryTree/AbstractContentItem.php | 5 ++- .../Models/ECommerce/ECommerceCategory.php | 5 ++- .../Models/ECommerce/ECommerceCustomer.php | 5 ++- .../Models/ECommerce/ECommerceProduct.php | 5 ++- .../Tests/Models/Forum/ForumAvatar.php | 1 + .../Tests/Models/Forum/ForumBoard.php | 1 + .../Tests/Models/Forum/ForumCategory.php | 5 ++- .../Tests/Models/Forum/ForumEntry.php | 6 +++- .../Models/Generic/NonAlphaColumnsEntity.php | 5 ++- .../Models/Global/GlobalNamespaceModel.php | 1 + .../Models/Issue5989/Issue5989Person.php | 1 + .../Tests/Models/Legacy/LegacyCar.php | 6 +++- .../Tests/Models/Legacy/LegacyUser.php | 11 ++++-- .../Models/NullDefault/NullDefaultColumn.php | 7 +++- .../Tests/Models/Pagination/Company.php | 5 ++- .../Tests/Models/Pagination/Department.php | 5 ++- tests/Doctrine/Tests/Models/Quote/City.php | 1 + tests/Doctrine/Tests/Models/Quote/Group.php | 1 + .../Tests/Models/Quote/NumericEntity.php | 5 ++- tests/Doctrine/Tests/Models/Quote/User.php | 6 +++- .../Models/Routing/RoutingRouteBooking.php | 1 + tests/Doctrine/Tests/Models/Taxi/Driver.php | 1 + tests/Doctrine/Tests/Models/Tweet/Tweet.php | 6 +++- tests/Doctrine/Tests/Models/Tweet/User.php | 1 + .../Doctrine/Tests/Models/Tweet/UserList.php | 6 +++- .../InversedOneToManyCompositeIdEntity.php | 5 ++- ...edOneToManyCompositeIdForeignKeyEntity.php | 5 ++- .../InversedOneToManyEntity.php | 5 ++- .../InversedOneToOneCompositeIdEntity.php | 5 ++- ...sedOneToOneCompositeIdForeignKeyEntity.php | 5 ++- .../InversedOneToOneEntity.php | 5 ++- .../Models/VersionedManyToOne/Article.php | 6 +++- .../Models/VersionedManyToOne/Category.php | 1 + .../Functional/AdvancedAssociationTest.php | 15 ++++++-- .../ORM/Functional/DefaultValuesTest.php | 15 ++++++-- .../ORM/Functional/Locking/OptimisticTest.php | 20 ++++++++--- .../Functional/MergeSharedEntitiesTest.php | 10 ++++-- ...edJoinedTableInheritanceCollectionTest.php | 5 ++- .../ORM/Functional/SchemaTool/DBAL483Test.php | 5 ++- .../ORM/Functional/Ticket/DDC1113Test.php | 19 ++++++++-- .../ORM/Functional/Ticket/DDC1225Test.php | 1 + .../ORM/Functional/Ticket/DDC1238Test.php | 7 +++- .../ORM/Functional/Ticket/DDC1335Test.php | 11 ++++-- .../ORM/Functional/Ticket/DDC1360Test.php | 7 +++- .../ORM/Functional/Ticket/DDC1383Test.php | 6 +++- .../ORM/Functional/Ticket/DDC1400Test.php | 2 ++ .../ORM/Functional/Ticket/DDC1404Test.php | 1 + .../ORM/Functional/Ticket/DDC1430Test.php | 6 +++- .../ORM/Functional/Ticket/DDC1436Test.php | 1 + .../ORM/Functional/Ticket/DDC1452Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC1458Test.php | 2 ++ .../ORM/Functional/Ticket/DDC1461Test.php | 2 ++ .../ORM/Functional/Ticket/DDC1509Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC1514Test.php | 15 ++++++-- .../ORM/Functional/Ticket/DDC1526Test.php | 5 ++- .../ORM/Functional/Ticket/DDC1655Test.php | 19 ++++++++-- .../ORM/Functional/Ticket/DDC1719Test.php | 5 ++- .../ORM/Functional/Ticket/DDC192Test.php | 6 +++- .../ORM/Functional/Ticket/DDC2012Test.php | 1 + .../ORM/Functional/Ticket/DDC2084Test.php | 1 + .../ORM/Functional/Ticket/DDC2106Test.php | 6 +++- .../ORM/Functional/Ticket/DDC211Test.php | 12 +++++-- .../ORM/Functional/Ticket/DDC2138Test.php | 12 +++++-- .../ORM/Functional/Ticket/DDC2175Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2214Test.php | 5 ++- .../ORM/Functional/Ticket/DDC2224Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2252Test.php | 3 ++ .../ORM/Functional/Ticket/DDC2256Test.php | 2 ++ .../ORM/Functional/Ticket/DDC2306Test.php | 20 ++++++++--- .../ORM/Functional/Ticket/DDC2346Test.php | 5 ++- .../ORM/Functional/Ticket/DDC2350Test.php | 5 ++- .../ORM/Functional/Ticket/DDC2494Test.php | 2 ++ .../ORM/Functional/Ticket/DDC2575Test.php | 2 ++ .../ORM/Functional/Ticket/DDC258Test.php | 30 ++++++++++++---- .../ORM/Functional/Ticket/DDC2602Test.php | 15 ++++++-- .../ORM/Functional/Ticket/DDC2759Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC2775Test.php | 15 ++++++-- .../ORM/Functional/Ticket/DDC279Test.php | 1 + .../ORM/Functional/Ticket/DDC2862Test.php | 2 ++ .../ORM/Functional/Ticket/DDC2895Test.php | 7 +++- .../ORM/Functional/Ticket/DDC2984Test.php | 5 ++- .../ORM/Functional/Ticket/DDC2996Test.php | 19 ++++++++-- .../ORM/Functional/Ticket/DDC309Test.php | 2 ++ .../ORM/Functional/Ticket/DDC3192Test.php | 1 + .../ORM/Functional/Ticket/DDC3223Test.php | 5 ++- .../ORM/Functional/Ticket/DDC3330Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC345Test.php | 3 ++ .../ORM/Functional/Ticket/DDC3644Test.php | 3 ++ .../ORM/Functional/Ticket/DDC371Test.php | 5 ++- .../ORM/Functional/Ticket/DDC440Test.php | 5 ++- .../ORM/Functional/Ticket/DDC444Test.php | 5 ++- .../ORM/Functional/Ticket/DDC448Test.php | 2 ++ .../ORM/Functional/Ticket/DDC493Test.php | 2 ++ .../ORM/Functional/Ticket/DDC512Test.php | 2 ++ .../ORM/Functional/Ticket/DDC513Test.php | 2 ++ .../ORM/Functional/Ticket/DDC531Test.php | 1 + .../ORM/Functional/Ticket/DDC588Test.php | 5 ++- .../ORM/Functional/Ticket/DDC599Test.php | 2 ++ .../ORM/Functional/Ticket/DDC618Test.php | 6 +++- .../ORM/Functional/Ticket/DDC6460Test.php | 2 ++ .../ORM/Functional/Ticket/DDC698Test.php | 15 ++++++-- .../ORM/Functional/Ticket/DDC719Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC729Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC735Test.php | 5 ++- .../ORM/Functional/Ticket/DDC837Test.php | 35 +++++++++++++++---- .../ORM/Functional/Ticket/DDC881Test.php | 8 ++++- .../ORM/Functional/Ticket/DDC960Test.php | 7 +++- .../ORM/Functional/Ticket/DDC992Test.php | 12 +++++-- .../ORM/Functional/Ticket/GH5762Test.php | 6 +++- 146 files changed, 672 insertions(+), 134 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsComment.php b/tests/Doctrine/Tests/Models/CMS/CmsComment.php index fd07a0e2e90..17075012909 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsComment.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsComment.php @@ -16,7 +16,10 @@ class CmsComment * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $topic; /** * @var string diff --git a/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php b/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php index 1da674bafb8..c8835790ce9 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php @@ -13,6 +13,7 @@ class CmsEmployee { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/CMS/CmsTag.php b/tests/Doctrine/Tests/Models/CMS/CmsTag.php index 162b9d2dc75..b436d0aa23e 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsTag.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsTag.php @@ -13,6 +13,7 @@ class CmsTag { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/Cache/Address.php b/tests/Doctrine/Tests/Models/Cache/Address.php index c6e1f8a09cb..231b01e10dd 100644 --- a/tests/Doctrine/Tests/Models/Cache/Address.php +++ b/tests/Doctrine/Tests/Models/Cache/Address.php @@ -11,6 +11,7 @@ class Address { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Attraction.php b/tests/Doctrine/Tests/Models/Cache/Attraction.php index 9391eb2fb8f..acaba9a30a2 100644 --- a/tests/Doctrine/Tests/Models/Cache/Attraction.php +++ b/tests/Doctrine/Tests/Models/Cache/Attraction.php @@ -20,6 +20,7 @@ abstract class Attraction { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/AttractionInfo.php b/tests/Doctrine/Tests/Models/Cache/AttractionInfo.php index 7d0ada988c4..8a67eaa9eb7 100644 --- a/tests/Doctrine/Tests/Models/Cache/AttractionInfo.php +++ b/tests/Doctrine/Tests/Models/Cache/AttractionInfo.php @@ -17,6 +17,7 @@ abstract class AttractionInfo { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/City.php b/tests/Doctrine/Tests/Models/Cache/City.php index 55c5992b515..c667f4b6b9b 100644 --- a/tests/Doctrine/Tests/Models/Cache/City.php +++ b/tests/Doctrine/Tests/Models/Cache/City.php @@ -15,6 +15,7 @@ class City { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Client.php b/tests/Doctrine/Tests/Models/Cache/Client.php index 17d3941ead9..a200bbe75c2 100644 --- a/tests/Doctrine/Tests/Models/Cache/Client.php +++ b/tests/Doctrine/Tests/Models/Cache/Client.php @@ -11,6 +11,7 @@ class Client { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Country.php b/tests/Doctrine/Tests/Models/Cache/Country.php index 07a1763c2c0..62cd093fe01 100644 --- a/tests/Doctrine/Tests/Models/Cache/Country.php +++ b/tests/Doctrine/Tests/Models/Cache/Country.php @@ -12,6 +12,7 @@ class Country { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Login.php b/tests/Doctrine/Tests/Models/Cache/Login.php index 4badfc11742..01f341d76b3 100644 --- a/tests/Doctrine/Tests/Models/Cache/Login.php +++ b/tests/Doctrine/Tests/Models/Cache/Login.php @@ -11,6 +11,7 @@ class Login { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Person.php b/tests/Doctrine/Tests/Models/Cache/Person.php index d026e153e7b..016c8d986b4 100644 --- a/tests/Doctrine/Tests/Models/Cache/Person.php +++ b/tests/Doctrine/Tests/Models/Cache/Person.php @@ -12,6 +12,7 @@ class Person { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/State.php b/tests/Doctrine/Tests/Models/Cache/State.php index 13a86448eb5..aefe9f1bb39 100644 --- a/tests/Doctrine/Tests/Models/Cache/State.php +++ b/tests/Doctrine/Tests/Models/Cache/State.php @@ -14,6 +14,7 @@ class State { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Travel.php b/tests/Doctrine/Tests/Models/Cache/Travel.php index 2c62c619c75..fd05452b47c 100644 --- a/tests/Doctrine/Tests/Models/Cache/Travel.php +++ b/tests/Doctrine/Tests/Models/Cache/Travel.php @@ -16,6 +16,7 @@ class Travel { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/Traveler.php b/tests/Doctrine/Tests/Models/Cache/Traveler.php index 36ce811ee3d..43d4739c4f3 100644 --- a/tests/Doctrine/Tests/Models/Cache/Traveler.php +++ b/tests/Doctrine/Tests/Models/Cache/Traveler.php @@ -15,6 +15,7 @@ class Traveler { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/TravelerProfile.php b/tests/Doctrine/Tests/Models/Cache/TravelerProfile.php index 5749ad15222..c50f6f62f4a 100644 --- a/tests/Doctrine/Tests/Models/Cache/TravelerProfile.php +++ b/tests/Doctrine/Tests/Models/Cache/TravelerProfile.php @@ -12,6 +12,7 @@ class TravelerProfile { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Cache/TravelerProfileInfo.php b/tests/Doctrine/Tests/Models/Cache/TravelerProfileInfo.php index 0402f60cc9b..4b99b8cf5cb 100644 --- a/tests/Doctrine/Tests/Models/Cache/TravelerProfileInfo.php +++ b/tests/Doctrine/Tests/Models/Cache/TravelerProfileInfo.php @@ -12,6 +12,7 @@ class TravelerProfileInfo { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Company/CompanyCar.php b/tests/Doctrine/Tests/Models/Company/CompanyCar.php index 5e940d814f7..d8032329130 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyCar.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyCar.php @@ -16,7 +16,10 @@ class CompanyCar */ private $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ private $brand; public function __construct($brand = null) diff --git a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php index 09c67fb2354..f2fd355f38e 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php @@ -13,7 +13,10 @@ class CompanyEmployee extends CompanyPerson /** @Column(type="integer") */ private $salary; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ private $department; /** @Column(type="datetime", nullable=true) */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyManager.php b/tests/Doctrine/Tests/Models/Company/CompanyManager.php index 9bd25caade4..5359378c477 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyManager.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyManager.php @@ -10,7 +10,10 @@ */ class CompanyManager extends CompanyEmployee { - /** @Column(type="string", length=250) */ + /** + * @var string + * @Column(type="string", length=250) + */ private $title; /** diff --git a/tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php b/tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php index ed2dbe8984d..4f0e215bc6a 100644 --- a/tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php +++ b/tests/Doctrine/Tests/Models/DDC1590/DDC1590Entity.php @@ -13,6 +13,7 @@ abstract class DDC1590Entity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/DDC1590/DDC1590User.php b/tests/Doctrine/Tests/Models/DDC1590/DDC1590User.php index 7bac8b55a32..c9917dfd6fe 100644 --- a/tests/Doctrine/Tests/Models/DDC1590/DDC1590User.php +++ b/tests/Doctrine/Tests/Models/DDC1590/DDC1590User.php @@ -12,6 +12,9 @@ */ class DDC1590User extends DDC1590Entity { - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ protected $name; } diff --git a/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php b/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php index bddb3049427..2c9c9e2b863 100644 --- a/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php +++ b/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php @@ -12,7 +12,10 @@ class DDC2372Address * @GeneratedValue(strategy="AUTO") */ private $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ private $street; /** @OneToOne(targetEntity="User", mappedBy="address") */ private $user; diff --git a/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php b/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php index 32d5108c903..7e625a5f327 100644 --- a/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php +++ b/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php @@ -16,7 +16,10 @@ class DDC2372User * @GeneratedValue(strategy="AUTO") */ private $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ private $name; public function getId() diff --git a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php index 7b95d3c4619..0f05c8d62d7 100644 --- a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php +++ b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1.php @@ -11,12 +11,16 @@ class DDC3231User1 { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ protected $name; } diff --git a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php index e9c8b215711..27ab1f19f66 100644 --- a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php +++ b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User1NoNamespace.php @@ -9,12 +9,16 @@ class DDC3231User1NoNamespace { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ protected $name; } diff --git a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php index 736f43e780b..ea190f4e997 100644 --- a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php +++ b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2.php @@ -11,12 +11,16 @@ class DDC3231User2 { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ protected $name; } diff --git a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php index e4c0f956b86..491dd458962 100644 --- a/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php +++ b/tests/Doctrine/Tests/Models/DDC3231/DDC3231User2NoNamespace.php @@ -9,12 +9,16 @@ class DDC3231User2NoNamespace { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ protected $name; } diff --git a/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php b/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php index 818a21efd45..68f4e1c4555 100644 --- a/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php +++ b/tests/Doctrine/Tests/Models/DDC3579/DDC3579User.php @@ -13,6 +13,7 @@ class DDC3579User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="user_id", length=150) diff --git a/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationMany.php b/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationMany.php index c1089fb11cf..08e713aad67 100644 --- a/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationMany.php +++ b/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationMany.php @@ -13,6 +13,9 @@ class DDC3699RelationMany /** @Id @Column(type="integer") */ public $id; - /** @ManyToOne(targetEntity="DDC3699Child", inversedBy="relations") */ + /** + * @var DDC3699Child + * @ManyToOne(targetEntity="DDC3699Child", inversedBy="relations") + */ public $child; } diff --git a/tests/Doctrine/Tests/Models/DDC3899/DDC3899Contract.php b/tests/Doctrine/Tests/Models/DDC3899/DDC3899Contract.php index 43275cde794..1962d47af87 100644 --- a/tests/Doctrine/Tests/Models/DDC3899/DDC3899Contract.php +++ b/tests/Doctrine/Tests/Models/DDC3899/DDC3899Contract.php @@ -22,6 +22,9 @@ abstract class DDC3899Contract /** @Column(type="boolean") */ public $completed = false; - /** @ManyToOne(targetEntity="DDC3899User", inversedBy="contract") */ + /** + * @var DDC3899User + * @ManyToOne(targetEntity="DDC3899User", inversedBy="contract") + */ public $user; } diff --git a/tests/Doctrine/Tests/Models/DDC4006/DDC4006UserId.php b/tests/Doctrine/Tests/Models/DDC4006/DDC4006UserId.php index 28840056f7e..64eb5b88cc3 100644 --- a/tests/Doctrine/Tests/Models/DDC4006/DDC4006UserId.php +++ b/tests/Doctrine/Tests/Models/DDC4006/DDC4006UserId.php @@ -10,6 +10,7 @@ class DDC4006UserId { /** + * @var int * @Id * @GeneratedValue("IDENTITY") * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php index 824bec39b13..23d394b09c9 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithCustomRepository.php @@ -10,6 +10,7 @@ class DDC753EntityWithCustomRepository { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php index 9306fd46368..42aaa68e182 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithDefaultCustomRepository.php @@ -10,6 +10,7 @@ class DDC753EntityWithDefaultCustomRepository { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php index 8d9aea69178..473c532b77e 100644 --- a/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php +++ b/tests/Doctrine/Tests/Models/DDC753/DDC753EntityWithInvalidRepository.php @@ -10,6 +10,7 @@ class DDC753EntityWithInvalidRepository { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php index 2b578ebaddb..e0cacdd3586 100644 --- a/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php +++ b/tests/Doctrine/Tests/Models/DDC869/DDC869Payment.php @@ -12,6 +12,7 @@ class DDC869Payment { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php b/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php index 63124909051..bf428c3ec58 100644 --- a/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php +++ b/tests/Doctrine/Tests/Models/DDC889/DDC889Class.php @@ -9,6 +9,7 @@ class DDC889Class extends DDC889SuperClass { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/DDC964/DDC964User.php b/tests/Doctrine/Tests/Models/DDC964/DDC964User.php index a6c9d93c106..f834faba507 100644 --- a/tests/Doctrine/Tests/Models/DDC964/DDC964User.php +++ b/tests/Doctrine/Tests/Models/DDC964/DDC964User.php @@ -13,6 +13,7 @@ class DDC964User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="user_id", length=150) diff --git a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php index 3beb89a4f30..3f8f3d2c5d4 100644 --- a/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php +++ b/tests/Doctrine/Tests/Models/DirectoryTree/AbstractContentItem.php @@ -17,7 +17,10 @@ abstract class AbstractContentItem */ private $id; - /** @ManyToOne(targetEntity="Directory") */ + /** + * @var Directory + * @ManyToOne(targetEntity="Directory") + */ protected $parentDirectory; /** @column(type="string") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php index 861365f12be..0dd612b4b00 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php @@ -21,7 +21,10 @@ class ECommerceCategory */ private $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ private $name; /** @ManyToMany(targetEntity="ECommerceProduct", mappedBy="categories") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php index 47fd90924ad..807bb72a491 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php @@ -20,7 +20,10 @@ class ECommerceCustomer */ private $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ private $name; /** @OneToOne(targetEntity="ECommerceCart", mappedBy="customer", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php index 10999ceb796..b95de138528 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php @@ -22,7 +22,10 @@ class ECommerceProduct */ private $id; - /** @Column(type="string", length=50, nullable=true) */ + /** + * @var string + * @Column(type="string", length=50, nullable=true) + */ private $name; /** diff --git a/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php b/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php index 0ff6b41725c..8ca549ea8dc 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumAvatar.php @@ -11,6 +11,7 @@ class ForumAvatar { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php index 2a24740550a..4bcd572f08a 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php @@ -13,6 +13,7 @@ class ForumBoard { /** + * @var int * @Id * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/Models/Forum/ForumCategory.php b/tests/Doctrine/Tests/Models/Forum/ForumCategory.php index 91d5209156c..7875b73a2b8 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumCategory.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumCategory.php @@ -17,7 +17,10 @@ class ForumCategory private $id; /** @Column(type="integer") */ public $position; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $name; /** @OneToMany(targetEntity="ForumBoard", mappedBy="category") */ public $boards; diff --git a/tests/Doctrine/Tests/Models/Forum/ForumEntry.php b/tests/Doctrine/Tests/Models/Forum/ForumEntry.php index 9304d9e2c6c..bf6ec03bd08 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumEntry.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumEntry.php @@ -11,12 +11,16 @@ class ForumEntry { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ public $topic; public function &getTopicByReference() diff --git a/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php b/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php index 2ec165cccb3..d58a5f8763c 100644 --- a/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php +++ b/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php @@ -17,7 +17,10 @@ class NonAlphaColumnsEntity */ public $id; - /** @Column(type="string", name="`simple-entity-value`") */ + /** + * @var string + * @Column(type="string", name="`simple-entity-value`") + */ public $value; public function __construct(string $value) diff --git a/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php b/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php index 4712f8bbedb..9e1533e62aa 100644 --- a/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php +++ b/tests/Doctrine/Tests/Models/Global/GlobalNamespaceModel.php @@ -9,6 +9,7 @@ class DoctrineGlobal_Article { /** + * @var int * @Id * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/Models/Issue5989/Issue5989Person.php b/tests/Doctrine/Tests/Models/Issue5989/Issue5989Person.php index 0c6146057aa..fddb1970032 100644 --- a/tests/Doctrine/Tests/Models/Issue5989/Issue5989Person.php +++ b/tests/Doctrine/Tests/Models/Issue5989/Issue5989Person.php @@ -18,6 +18,7 @@ class Issue5989Person { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php index 88b498bc856..d7ff99c4e94 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php @@ -11,6 +11,7 @@ class LegacyCar { /** + * @var int * @Id * @GeneratedValue * @Column(name="iCarId", type="integer", nullable=false) @@ -19,7 +20,10 @@ class LegacyCar /** @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars") */ public $_users; - /** @Column(name="sDescription", type="string", length=255, unique=true) */ + /** + * @var string + * @Column(name="sDescription", type="string", length=255, unique=true) + */ public $_description; public function getDescription() diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php index d32ee9e39aa..46381c25283 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyUser.php @@ -13,14 +13,21 @@ class LegacyUser { /** + * @var int * @Id * @GeneratedValue * @Column(name="iUserId", type="integer", nullable=false) */ public $_id; - /** @Column(name="sUsername", type="string", length=255, unique=true) */ + /** + * @var string + * @Column(name="sUsername", type="string", length=255, unique=true) + */ public $_username; - /** @Column(type="string", length=255, name="name") */ + /** + * @var string + * @Column(type="string", length=255, name="name") + */ public $_name; /** @OneToMany(targetEntity="LegacyArticle", mappedBy="user") */ public $_articles; diff --git a/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php b/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php index 7d2c824bdaf..279f613e4e1 100644 --- a/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php +++ b/tests/Doctrine/Tests/Models/NullDefault/NullDefaultColumn.php @@ -7,7 +7,12 @@ /** @Entity */ class NullDefaultColumn { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @Column(options={"default":NULL}) */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Company.php b/tests/Doctrine/Tests/Models/Pagination/Company.php index 97fdac867d1..39fd66b5a66 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Company.php +++ b/tests/Doctrine/Tests/Models/Pagination/Company.php @@ -24,7 +24,10 @@ class Company */ public $name; - /** @Column(type="string", name="jurisdiction_code", nullable=true) */ + /** + * @var string + * @Column(type="string", name="jurisdiction_code", nullable=true) + */ public $jurisdiction; /** @OneToOne(targetEntity="Logo", mappedBy="company", cascade={"persist"}, orphanRemoval=true) */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Department.php b/tests/Doctrine/Tests/Models/Pagination/Department.php index e085ae5782e..5033a167a5c 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Department.php +++ b/tests/Doctrine/Tests/Models/Pagination/Department.php @@ -24,6 +24,9 @@ class Department */ public $name; - /** @ManyToOne(targetEntity="Company", inversedBy="departments", cascade={"persist"}) */ + /** + * @var Company + * @ManyToOne(targetEntity="Company", inversedBy="departments", cascade={"persist"}) + */ public $company; } diff --git a/tests/Doctrine/Tests/Models/Quote/City.php b/tests/Doctrine/Tests/Models/Quote/City.php index 6aaf7c9ab06..334b6ea96fe 100644 --- a/tests/Doctrine/Tests/Models/Quote/City.php +++ b/tests/Doctrine/Tests/Models/Quote/City.php @@ -11,6 +11,7 @@ class City { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="`city-id`") diff --git a/tests/Doctrine/Tests/Models/Quote/Group.php b/tests/Doctrine/Tests/Models/Quote/Group.php index 87da7abd9bf..0e43302654b 100644 --- a/tests/Doctrine/Tests/Models/Quote/Group.php +++ b/tests/Doctrine/Tests/Models/Quote/Group.php @@ -11,6 +11,7 @@ class Group { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="`group-id`") diff --git a/tests/Doctrine/Tests/Models/Quote/NumericEntity.php b/tests/Doctrine/Tests/Models/Quote/NumericEntity.php index 0fa938a32c4..ac50f304bcb 100644 --- a/tests/Doctrine/Tests/Models/Quote/NumericEntity.php +++ b/tests/Doctrine/Tests/Models/Quote/NumericEntity.php @@ -17,7 +17,10 @@ class NumericEntity */ public $id; - /** @Column(type="string", name="`2:2`") */ + /** + * @var string + * @Column(type="string", name="`2:2`") + */ public $value; public function __construct(string $value) diff --git a/tests/Doctrine/Tests/Models/Quote/User.php b/tests/Doctrine/Tests/Models/Quote/User.php index 93b813006a3..b9899f35c31 100644 --- a/tests/Doctrine/Tests/Models/Quote/User.php +++ b/tests/Doctrine/Tests/Models/Quote/User.php @@ -13,13 +13,17 @@ class User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="`user-id`") */ public $id; - /** @Column(type="string", name="`user-name`") */ + /** + * @var string + * @Column(type="string", name="`user-name`") + */ public $name; /** @OneToMany(targetEntity="Phone", mappedBy="user", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php index cf33001823a..664657f2e0d 100644 --- a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php +++ b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php @@ -10,6 +10,7 @@ class RoutingRouteBooking { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/Models/Taxi/Driver.php b/tests/Doctrine/Tests/Models/Taxi/Driver.php index 550474eed3c..312a54330b1 100644 --- a/tests/Doctrine/Tests/Models/Taxi/Driver.php +++ b/tests/Doctrine/Tests/Models/Taxi/Driver.php @@ -11,6 +11,7 @@ class Driver { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/Tweet/Tweet.php b/tests/Doctrine/Tests/Models/Tweet/Tweet.php index 2e644db67e5..f105bc051b2 100644 --- a/tests/Doctrine/Tests/Models/Tweet/Tweet.php +++ b/tests/Doctrine/Tests/Models/Tweet/Tweet.php @@ -11,6 +11,7 @@ class Tweet { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -23,7 +24,10 @@ class Tweet */ public $content; - /** @ManyToOne(targetEntity="User", inversedBy="tweets") */ + /** + * @var User + * @ManyToOne(targetEntity="User", inversedBy="tweets") + */ public $author; public function setAuthor(User $user): void diff --git a/tests/Doctrine/Tests/Models/Tweet/User.php b/tests/Doctrine/Tests/Models/Tweet/User.php index b439d087ccf..a5508287f46 100644 --- a/tests/Doctrine/Tests/Models/Tweet/User.php +++ b/tests/Doctrine/Tests/Models/Tweet/User.php @@ -13,6 +13,7 @@ class User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/Models/Tweet/UserList.php b/tests/Doctrine/Tests/Models/Tweet/UserList.php index c78e7536e37..05511081239 100644 --- a/tests/Doctrine/Tests/Models/Tweet/UserList.php +++ b/tests/Doctrine/Tests/Models/Tweet/UserList.php @@ -11,6 +11,7 @@ class UserList { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -23,6 +24,9 @@ class UserList */ public $listName; - /** @ManyToOne(targetEntity="User", inversedBy="userLists") */ + /** + * @var User + * @ManyToOne(targetEntity="User", inversedBy="userLists") + */ public $owner; } diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdEntity.php index 911a04d8ecf..ef2f02e378e 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdEntity.php @@ -24,7 +24,10 @@ class InversedOneToManyCompositeIdEntity */ public $id2; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; /** @OneToMany(targetEntity="OwningManyToOneCompositeIdEntity", mappedBy="associatedEntity") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdForeignKeyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdForeignKeyEntity.php index 9214e12b361..67e9e2f9d4c 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdForeignKeyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyCompositeIdForeignKeyEntity.php @@ -25,7 +25,10 @@ class InversedOneToManyCompositeIdForeignKeyEntity */ public $foreignEntity; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; /** @OneToMany(targetEntity="OwningManyToOneCompositeIdForeignKeyEntity", mappedBy="associatedEntity") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyEntity.php index 81da0bc3179..648adb81c37 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToManyEntity.php @@ -21,7 +21,10 @@ class InversedOneToManyEntity /** @OneToMany(targetEntity="OwningManyToOneEntity", mappedBy="associatedEntity") */ public $associatedEntities; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; public function __construct() diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php index 4fd007639b6..8e075d293f5 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php @@ -22,7 +22,10 @@ class InversedOneToOneCompositeIdEntity */ public $id2; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; /** @OneToOne(targetEntity="OwningOneToOneCompositeIdEntity", mappedBy="associatedEntity") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php index 69ca896f631..03f8885e894 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php @@ -23,7 +23,10 @@ class InversedOneToOneCompositeIdForeignKeyEntity */ public $foreignEntity; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; /** @OneToOne(targetEntity="OwningOneToOneCompositeIdForeignKeyEntity", mappedBy="associatedEntity") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php index ecc68f70dea..7b7b5e5ada7 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php @@ -16,7 +16,10 @@ class InversedOneToOneEntity */ public $id1; - /** @Column(type="string", name="some_property") */ + /** + * @var string + * @Column(type="string", name="some_property") + */ public $someProperty; /** @OneToOne(targetEntity="OwningOneToOneEntity", mappedBy="associatedEntity") */ diff --git a/tests/Doctrine/Tests/Models/VersionedManyToOne/Article.php b/tests/Doctrine/Tests/Models/VersionedManyToOne/Article.php index e49ba257ba8..b76ddb07350 100644 --- a/tests/Doctrine/Tests/Models/VersionedManyToOne/Article.php +++ b/tests/Doctrine/Tests/Models/VersionedManyToOne/Article.php @@ -11,6 +11,7 @@ class Article { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") @@ -20,7 +21,10 @@ class Article /** @Column(name="name") */ public $name; - /** @ManyToOne(targetEntity="Category", cascade={"merge", "persist"}) */ + /** + * @var Category + * @ManyToOne(targetEntity="Category", cascade={"merge", "persist"}) + */ public $category; /** diff --git a/tests/Doctrine/Tests/Models/VersionedManyToOne/Category.php b/tests/Doctrine/Tests/Models/VersionedManyToOne/Category.php index a002ccc5195..6a5a7dd24a7 100644 --- a/tests/Doctrine/Tests/Models/VersionedManyToOne/Category.php +++ b/tests/Doctrine/Tests/Models/VersionedManyToOne/Category.php @@ -11,6 +11,7 @@ class Category { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php index 1f6d14e7974..9f315d8bd15 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php @@ -333,7 +333,10 @@ class Phrase */ private $id; - /** @Column(type="string", name="phrase_name", unique=true, length=255) */ + /** + * @var string + * @Column(type="string", name="phrase_name", unique=true, length=255) + */ private $phrase; /** @@ -402,10 +405,16 @@ class PhraseType */ private $id; - /** @Column(type="string", name="phrase_type_name", unique=true) */ + /** + * @var string + * @Column(type="string", name="phrase_type_name", unique=true) + */ private $type; - /** @Column(type="string", name="phrase_type_abbreviation", unique=true) */ + /** + * @var string + * @Column(type="string", name="phrase_type_abbreviation", unique=true) + */ private $abbreviation; /** @OneToMany(targetEntity="Phrase", mappedBy="type") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index 09fc56d89dd..e035dc4ea8d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -133,13 +133,22 @@ class DefaultValueAddress */ public $id; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ public $country; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ public $zip; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ public $city; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php index 2f55083b9f0..4cf5967e7c4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php @@ -278,7 +278,10 @@ class OptimisticJoinedParent */ public $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $name; /** @Version @Column(type="integer") */ @@ -291,7 +294,10 @@ class OptimisticJoinedParent */ class OptimisticJoinedChild extends OptimisticJoinedParent { - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $whatever; } @@ -307,7 +313,10 @@ class OptimisticStandard */ public $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $name; /** @Version @Column(type="integer") */ @@ -331,7 +340,10 @@ class OptimisticTimestamp */ public $id; - /** @Column(type="string", length=255) */ + /** + * @var string + * @Column(type="string", length=255) + */ public $name; /** @Version @Column(type="datetime") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php index f0e414cbe39..70465244a4b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php @@ -113,10 +113,16 @@ class MSEPicture /** @Column(type="integer") @Id @GeneratedValue */ public $id; - /** @ManyToOne(targetEntity="MSEFile", cascade={"merge"}) */ + /** + * @var MSEFile + * @ManyToOne(targetEntity="MSEFile", cascade={"merge"}) + */ public $file; - /** @ManyToOne(targetEntity="MSEFile", cascade={"merge"}) */ + /** + * @var MSEFile + * @ManyToOne(targetEntity="MSEFile", cascade={"merge"}) + */ public $otherFile; } diff --git a/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php b/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php index 43e4c530cd7..5c91aecf729 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OrderedJoinedTableInheritanceCollectionTest.php @@ -92,7 +92,10 @@ abstract class OJTIC_Pet /** @Column */ public $name; - /** @ManyToOne(targetEntity="OJTIC_PET") */ + /** + * @var OJTIC_PET + * @ManyToOne(targetEntity="OJTIC_PET") + */ public $mother; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php index 03cd246c9a9..7dec236c3c1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php @@ -57,6 +57,9 @@ class DBAL483Default /** @Column(type="integer", options={"default": 0}) */ public $num; - /** @Column(type="string", options={"default": "foo"}) */ + /** + * @var string + * @Column(type="string", options={"default": "foo"}) + */ public $str = 'foo'; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php index 42ce37c62d7..41e412b7312 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php @@ -61,10 +61,18 @@ public function testIssue(): void */ class DDC1113Vehicle { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; - /** @ManyToOne(targetEntity="DDC1113Vehicle") */ + /** + * @var DDC1113Vehicle + * @ManyToOne(targetEntity="DDC1113Vehicle") + */ public $parent; /** @OneToOne(targetEntity="DDC1113Engine", cascade={"persist", "remove"}) */ @@ -90,6 +98,11 @@ class DDC1113Bus extends DDC1113Vehicle */ class DDC1113Engine { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1225Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1225Test.php index 7cec13b09f8..2ea0aa1a386 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1225Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1225Test.php @@ -74,6 +74,7 @@ public function getTestEntity2(): DDC1225_TestEntity2 class DDC1225_TestEntity2 { /** + * @var int * @Id * @GeneratedValue(strategy="AUTO") * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php index cdabee854ea..9f167eb76d5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1238Test.php @@ -74,7 +74,12 @@ public function testIssueProxyClear(): void */ class DDC1238User { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ private $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php index f9972100c17..824170b5b13 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php @@ -164,7 +164,10 @@ class DDC1335User */ public $id; - /** @Column(type="string", unique=true) */ + /** + * @var string + * @Column(type="string", unique=true) + */ public $email; /** @@ -194,13 +197,17 @@ public function __construct($email, $name, array $numbers = []) class DDC1335Phone { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue */ public $id; - /** @Column(name="numericalValue", type="string", nullable = false) */ + /** + * @var string + * @Column(name="numericalValue", type="string", nullable = false) + */ public $numericalValue; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1360Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1360Test.php index 333bb7a032a..3beb8ecd2e7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1360Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1360Test.php @@ -39,6 +39,11 @@ public function testSchemaDoubleQuotedCreate(): void */ class DDC1360DoubleQuote { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php index 4f663d41e54..9c65e0003a6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1383Test.php @@ -75,6 +75,7 @@ public function testFailingCase(): void abstract class DDC1383AbstractEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -97,7 +98,10 @@ public function setId($id): void */ class DDC1383Entity extends DDC1383AbstractEntity { - /** @ManyToOne(targetEntity="DDC1383AbstractEntity") */ + /** + * @var DDC1383AbstractEntity + * @ManyToOne(targetEntity="DDC1383AbstractEntity") + */ protected $reference; public function getReference() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php index 1c574e4aae9..de8e53f72c5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1400Test.php @@ -76,6 +76,7 @@ public function testFailingCase(): void class DDC1400Article { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -92,6 +93,7 @@ class DDC1400Article class DDC1400User { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php index 5e2dd53cb56..7d64fec0027 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1404Test.php @@ -68,6 +68,7 @@ public function loadFixtures(): void class DDC1404ParentEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php index 9cecdb66c33..aa93ce5c0c6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1430Test.php @@ -141,6 +141,7 @@ public function loadFixtures(): void class DDC1430Order { /** + * @var int * @Id * @Column(name="order_id", type="integer") * @GeneratedValue() @@ -150,7 +151,10 @@ class DDC1430Order /** @Column(name="created_at", type="datetime") */ private $date; - /** @Column(name="order_status", type="string") */ + /** + * @var string + * @Column(name="order_status", type="string") + */ private $status; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php index 2752c9803d2..b7f9a56a30c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php @@ -64,6 +64,7 @@ public function testIdentityMap(): void class DDC1436Page { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="id") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php index d1ac1490149..27de25cd0b9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1452Test.php @@ -133,8 +133,14 @@ class DDC1452EntityB */ public $id; - /** @ManyToOne(targetEntity="DDC1452EntityA", inversedBy="entitiesB") */ + /** + * @var DDC1452EntityA + * @ManyToOne(targetEntity="DDC1452EntityA", inversedBy="entitiesB") + */ public $entityAFrom; - /** @ManyToOne(targetEntity="DDC1452EntityA") */ + /** + * @var DDC1452EntityA + * @ManyToOne(targetEntity="DDC1452EntityA") + */ public $entityATo; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php index 7aa22acf07f..4c54e379a2d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php @@ -60,6 +60,7 @@ public function testIssue(): void class TestEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -96,6 +97,7 @@ public function setAdditional($additional): void class TestAdditionalEntity { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php index 64f1795941a..3a41a31b8c0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php @@ -57,6 +57,7 @@ public function testChangeDetectionDeferredExplicit(): void class DDC1461User { /** + * @var int * @Id * @GeneratedValue(strategy="AUTO") * @Column(type="integer") @@ -77,6 +78,7 @@ class DDC1461User class DDC1461TwitterAccount { /** + * @var int * @Id * @GeneratedValue(strategy="AUTO") * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php index 596b0613890..03860ce1173 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php @@ -72,10 +72,16 @@ class DDC1509Picture */ private $id; - /** @ManyToOne(targetEntity="DDC1509AbstractFile", cascade={"persist", "remove"}) */ + /** + * @var DDC1509AbstractFile + * @ManyToOne(targetEntity="DDC1509AbstractFile", cascade={"persist", "remove"}) + */ private $thumbnail; - /** @ManyToOne(targetEntity="DDC1509AbstractFile", cascade={"persist", "remove"}) */ + /** + * @var DDC1509AbstractFile + * @ManyToOne(targetEntity="DDC1509AbstractFile", cascade={"persist", "remove"}) + */ private $file; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php index 3a202bf9b6a..783ec541075 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php @@ -84,7 +84,10 @@ class DDC1514EntityA public $title; /** @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") */ public $entitiesB; - /** @ManyToOne(targetEntity="DDC1514EntityC") */ + /** + * @var DDC1514EntityC + * @ManyToOne(targetEntity="DDC1514EntityC") + */ public $entityC; public function __construct() @@ -106,9 +109,15 @@ class DDC1514EntityB */ public $id; - /** @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB") */ + /** + * @var DDC1514EntityA + * @ManyToOne(targetEntity="DDC1514EntityA", inversedBy="entitiesB") + */ public $entityAFrom; - /** @ManyToOne(targetEntity="DDC1514EntityA") */ + /** + * @var DDC1514EntityA + * @ManyToOne(targetEntity="DDC1514EntityA") + */ public $entityATo; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php index e1d4aae447b..ed82ae257e4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php @@ -61,7 +61,10 @@ class DDC1526Menu * @GeneratedValue */ public $id; - /** @ManyToOne(targetEntity="DDC1526Menu", inversedBy="children") */ + /** + * @var DDC1526Menu + * @ManyToOne(targetEntity="DDC1526Menu", inversedBy="children") + */ public $parent; /** @OneToMany(targetEntity="DDC1526Menu", mappedBy="parent") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php index 33b43ed5529..7096b080d77 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1655Test.php @@ -102,12 +102,20 @@ public function testPostLoadInheritanceChild(): void */ class DDC1655Foo { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; public $loaded = 0; - /** @ManyToOne(targetEntity="DDC1655Baz", inversedBy="foos") */ + /** + * @var DDC1655Baz + * @ManyToOne(targetEntity="DDC1655Baz", inversedBy="foos") + */ public $baz; /** @@ -141,7 +149,12 @@ public function postSubLoaded(): void */ class DDC1655Baz { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @OneToMany(targetEntity="DDC1655Foo", mappedBy="baz") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php index 423d14cd201..3f8d1b6cf83 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php @@ -106,7 +106,10 @@ class DDC1719SimpleEntity */ public $id; - /** @Column(type="string", name="`simple-entity-value`") */ + /** + * @var string + * @Column(type="string", name="`simple-entity-value`") + */ public $value; public function __construct(string $value) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php index d05f8d3a552..06e8d950fe8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC192Test.php @@ -41,13 +41,17 @@ public function testSchemaCreation(): void class DDC192User { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; - /** @Column(name="name", type="string") */ + /** + * @var string + * @Column(name="name", type="string") + */ public $name; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php index ce04e4db550..70c9301b9c3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php @@ -88,6 +88,7 @@ public function testIssue(): void class DDC2012Item { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2084Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2084Test.php index cd9fbc4c3bc..8c8ac10bf91 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2084Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2084Test.php @@ -100,6 +100,7 @@ public function getMyEntity2() class MyEntity2 { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php index ada0c630fd6..ebee381596e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php @@ -49,13 +49,17 @@ public function testDetachedEntityAsId(): void class DDC2106Entity { /** + * @var int * @Id * @GeneratedValue(strategy="IDENTITY") * @Column(type="integer") */ public $id; - /** @ManyToOne(targetEntity="DDC2106Entity", inversedBy="children") */ + /** + * @var DDC2106Entity + * @ManyToOne(targetEntity="DDC2106Entity", inversedBy="children") + */ public $parent; /** @OneToMany(targetEntity="DDC2106Entity", mappedBy="parent", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php index 766d4360016..12dec5893b7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php @@ -56,13 +56,17 @@ public function testIssue(): void class DDC211User { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(name="name", type="string") */ + /** + * @var string + * @Column(name="name", type="string") + */ protected $name; /** @@ -97,13 +101,17 @@ public function getGroups() class DDC211Group { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(name="name", type="string") */ + /** + * @var string + * @Column(name="name", type="string") + */ protected $name; /** @ManyToMany(targetEntity="DDC211User", mappedBy="groups") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php index ca166b33131..66b8f00c34e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2138Test.php @@ -60,13 +60,17 @@ public function testForeignKeyOnSTIWithMultipleMapping(): void class DDC2138Structure { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=32, nullable=true) */ + /** + * @var string + * @Column(type="string", length=32, nullable=true) + */ protected $name; } @@ -189,13 +193,17 @@ public function getFollowedUser(): User class DDC2138User { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="string", length=32, nullable=true) */ + /** + * @var string + * @Column(type="string", length=32, nullable=true) + */ protected $name; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php index 08a8032be78..723cc00ce23 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2175Test.php @@ -50,7 +50,12 @@ public function testIssue(): void */ class DDC2175Entity { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2214Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2214Test.php index 3200e7369b6..08fdc0c2ce9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2214Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2214Test.php @@ -67,7 +67,10 @@ class DDC2214Foo /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ public $id; - /** @ManyToOne(targetEntity="DDC2214Bar") */ + /** + * @var DDC2214Bar + * @ManyToOne(targetEntity="DDC2214Bar") + */ public $bar; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php index fccd69443d3..57e8892c5a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php @@ -81,7 +81,12 @@ public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform) */ class DDC2224Entity { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @Column(type="DDC2224Type") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php index b955ab3beb7..d50b99dacd0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2252Test.php @@ -111,6 +111,7 @@ public function testIssue(): void class DDC2252Privilege { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -130,6 +131,7 @@ public function getPrivilegeid() class DDC2252MerchantAccount { /** + * @var int * @Id * @Column(type="integer") */ @@ -148,6 +150,7 @@ public function getAccountid() class DDC2252User { /** + * @var int * @Id * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php index 115120b2363..70abe331299 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php @@ -73,6 +73,7 @@ public function testIssue(): void class DDC2256User { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -99,6 +100,7 @@ class DDC2256User class DDC2256Group { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php index f1b2b6bed14..42aaf38a409 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2306Test.php @@ -111,7 +111,10 @@ class DDC2306User */ public $addresses; - /** @ManyToOne(targetEntity="DDC2306Zone", fetch="EAGER") */ + /** + * @var DDC2306Zone + * @ManyToOne(targetEntity="DDC2306Zone", fetch="EAGER") + */ public $zone; /** Constructor */ @@ -138,7 +141,10 @@ class DDC2306Address */ public $users; - /** @ManyToOne(targetEntity="DDC2306Zone", fetch="EAGER") */ + /** + * @var DDC2306Zone + * @ManyToOne(targetEntity="DDC2306Zone", fetch="EAGER") + */ public $zone; /** Constructor */ @@ -159,10 +165,16 @@ class DDC2306UserAddress */ public $id; - /** @ManyToOne(targetEntity="DDC2306User") */ + /** + * @var DDC2306User + * @ManyToOne(targetEntity="DDC2306User") + */ public $user; - /** @ManyToOne(targetEntity="DDC2306Address", fetch="LAZY") */ + /** + * @var DDC2306Address + * @ManyToOne(targetEntity="DDC2306Address", fetch="LAZY") + */ public $address; /** Constructor */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php index 250e05c2958..b4252c2f5f5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2346Test.php @@ -106,7 +106,10 @@ class DDC2346Bar */ public $id; - /** @ManyToOne(targetEntity="DDC2346Foo", inversedBy="bars", fetch="EAGER") */ + /** + * @var DDC2346Foo + * @ManyToOne(targetEntity="DDC2346Foo", inversedBy="bars", fetch="EAGER") + */ public $foo; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php index d8dc0c553c7..b113b7f9801 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php @@ -80,6 +80,9 @@ class DDC2350Bug * @GeneratedValue */ public $id; - /** @ManyToOne(targetEntity="DDC2350User", inversedBy="reportedBugs") */ + /** + * @var DDC2350User + * @ManyToOne(targetEntity="DDC2350User", inversedBy="reportedBugs") + */ public $user; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2494Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2494Test.php index 754a8d1c48b..07a17727eb0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2494Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2494Test.php @@ -81,6 +81,7 @@ public function testIssue(): void class DDC2494Currency { /** + * @var int * @Id * @Column(type="integer", type="ddc2494_tinyint") */ @@ -124,6 +125,7 @@ public function getCampaigns() class DDC2494Campaign { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php index 45d9ded7964..c7de66fbe16 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php @@ -94,6 +94,7 @@ public function testHydrationIssue(): void class DDC2575Root { /** + * @var int * @Id * @Column(type="integer") */ @@ -143,6 +144,7 @@ public function __construct(DDC2575Root $rootRelation, DDC2575B $bRelation) class DDC2575B { /** + * @var int * @Id * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php index e69f487d65e..185341dc7a6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php @@ -96,10 +96,16 @@ abstract class DDC258Super */ class DDC258Class1 extends DDC258Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $title; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $description; } @@ -108,10 +114,16 @@ class DDC258Class1 extends DDC258Super */ class DDC258Class2 extends DDC258Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $title; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $description; /** @Column(name="text", type="text") */ @@ -125,9 +137,15 @@ class DDC258Class2 extends DDC258Super */ class DDC258Class3 extends DDC258Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $apples; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $bananas; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2602Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2602Test.php index 1c4156f5ab3..1da33b81918 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2602Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2602Test.php @@ -242,10 +242,16 @@ class DDC2602BiographyField */ public $id; - /** @Column(type="string", unique=true, length=100) */ + /** + * @var string + * @Column(type="string", unique=true, length=100) + */ public $alias; - /** @Column(type="string", length=100) */ + /** + * @var string + * @Column(type="string", length=100) + */ public $label; /** @@ -276,7 +282,10 @@ class DDC2602BiographyFieldChoice */ public $id; - /** @Column(type="string", unique=true, length=100) */ + /** + * @var string + * @Column(type="string", unique=true, length=100) + */ public $label; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php index e6a62b5a599..12aaf6cdb2d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php @@ -131,10 +131,16 @@ class DDC2759MetadataCategory */ public $id; - /** @ManyToOne(targetEntity="DDC2759QualificationMetadata", inversedBy="metadataCategories") */ + /** + * @var DDC2759QualificationMetadata + * @ManyToOne(targetEntity="DDC2759QualificationMetadata", inversedBy="metadataCategories") + */ public $metadata; - /** @ManyToOne(targetEntity="DDC2759Category", inversedBy="metadataCategories") */ + /** + * @var DDC2759Category + * @ManyToOne(targetEntity="DDC2759Category", inversedBy="metadataCategories") + */ public $category; public function __construct(DDC2759QualificationMetadata $metadata, DDC2759Category $category) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php index c8ad3e32a46..31072c87fae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php @@ -70,7 +70,10 @@ abstract class Role */ public $id; - /** @ManyToOne(targetEntity="User", inversedBy="roles") */ + /** + * @var User + * @ManyToOne(targetEntity="User", inversedBy="roles") + */ public $user; /** @OneToMany(targetEntity="Authorization", mappedBy="role", cascade={"all"}, orphanRemoval=true) */ @@ -99,10 +102,16 @@ class Authorization */ public $id; - /** @ManyToOne(targetEntity="User", inversedBy="authorizations") */ + /** + * @var User + * @ManyToOne(targetEntity="User", inversedBy="authorizations") + */ public $user; - /** @ManyToOne(targetEntity="Role", inversedBy="authorizations") */ + /** + * @var Role + * @ManyToOne(targetEntity="Role", inversedBy="authorizations") + */ public $role; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php index 0f703e98ab0..476911e1449 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php @@ -73,6 +73,7 @@ public function testDDC279(): void abstract class DDC279EntityXAbstract { /** + * @var int * @Id * @GeneratedValue * @Column(name="id", type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php index 189a5f9c806..700b181d4a8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2862Test.php @@ -123,6 +123,7 @@ public function testIssueReopened(): void class DDC2862Driver { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -182,6 +183,7 @@ public function getUserProfile(): DDC2862User class DDC2862User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2895Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2895Test.php index 15607a492cb..457c12a3c7d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2895Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2895Test.php @@ -89,7 +89,12 @@ public function getLastModified(): DateTime */ class DDC2895 extends AbstractDDC2895 { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php index d0f7cf38a75..8e3505ebd37 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2984Test.php @@ -75,7 +75,10 @@ class DDC2984User */ private $userId; - /** @Column(type="string", length=50) */ + /** + * @var string + * @Column(type="string", length=50) + */ private $name; public function __construct(DDC2984DomainUserId $aUserId) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php index 0f1fb31d37a..c79d29280d3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php @@ -47,7 +47,12 @@ public function testIssue(): void */ class DDC2996User { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @Column(type="integer") */ public $counter = 0; @@ -58,7 +63,12 @@ class DDC2996User */ class DDC2996UserPreference { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** * @var string @@ -66,7 +76,10 @@ class DDC2996UserPreference */ public $value; - /** @ManyToOne(targetEntity="DDC2996User") */ + /** + * @var DDC2996User + * @ManyToOne(targetEntity="DDC2996User") + */ public $user; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php index 14c3c256108..159caeeeed9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC309Test.php @@ -57,6 +57,7 @@ public function testTwoIterateHydrations(): void class DDC309Country { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue @@ -70,6 +71,7 @@ class DDC309Country class DDC309User { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3192Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3192Test.php index e9a8cc1cd0b..fc4ed71b954 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3192Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3192Test.php @@ -102,6 +102,7 @@ public function __construct($code) class DDC3192Transaction { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php index 8d2a8f50764..69ebf415f4b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3223Test.php @@ -69,7 +69,10 @@ class Participant */ public $id; - /** @ManyToOne(targetEntity="ProfileStatus") */ + /** + * @var ProfileStatus + * @ManyToOne(targetEntity="ProfileStatus") + */ public $profileStatus; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php index 77775ed3f26..9882e0b4942 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php @@ -98,9 +98,15 @@ class DDC3330_Hall */ public $id; - /** @ManyToOne(targetEntity="DDC3330_Building", inversedBy="halls") */ + /** + * @var DDC3330_Building + * @ManyToOne(targetEntity="DDC3330_Building", inversedBy="halls") + */ public $building; - /** @Column(type="string", length=100) */ + /** + * @var string + * @Column(type="string", length=100) + */ public $name; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php index a8846b9d5ba..6329df3c260 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php @@ -64,6 +64,7 @@ public function testTwoIterateHydrations(): void class DDC345User { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -91,6 +92,7 @@ public function __construct() class DDC345Group { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue @@ -122,6 +124,7 @@ public function __construct() class DDC345Membership { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php index effcfbebdf9..c407bbff5f5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php @@ -137,6 +137,7 @@ public function testIssueWithJoinedEntity(): void class DDC3644User { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer", name="hash_id") @@ -184,6 +185,7 @@ public function setPets(Collection $pets): void class DDC3644Address { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") @@ -217,6 +219,7 @@ public function __construct($address) abstract class DDC3644Animal { /** + * @var int * @Id * @GeneratedValue * @Column(type="integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php index adad584e60a..af890a41d04 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC371Test.php @@ -73,7 +73,10 @@ class DDC371Child * @Column(type="string") */ public $data; - /** @ManyToOne(targetEntity="DDC371Parent", inversedBy="children") @JoinColumn(name="parentId") */ + /** + * @var DDC371Parent + * @ManyToOne(targetEntity="DDC371Parent", inversedBy="children") @JoinColumn(name="parentId") + */ public $parent; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index 5b5ad626692..11330aa189e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -167,7 +167,10 @@ class DDC440Client * @OrderBy({"number"="ASC"}) */ protected $phones; - /** @Column(name="name", type="string") */ + /** + * @var string + * @Column(name="name", type="string") + */ protected $name; public function __construct() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php index f2f72adbd5c..51f53efb51b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php @@ -70,6 +70,9 @@ class DDC444User */ public $id; - /** @Column(name="name", type="string") */ + /** + * @var string + * @Column(name="name", type="string") + */ public $name; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php index b5d8d4dd371..14a21dcfb6c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php @@ -44,6 +44,7 @@ public function testIssue(): void class DDC448MainTable { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") @@ -65,6 +66,7 @@ class DDC448MainTable class DDC448ConnectedClass { /** + * @var int * @Id * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php index 25bd2150bd2..7036a2123d3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php @@ -41,6 +41,7 @@ public function testIssue(): void class DDC493Customer { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -66,6 +67,7 @@ class DDC493Distributor extends DDC493Customer class DDC493Contact { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php index 0c133115bfc..3c2e157e44c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php @@ -58,6 +58,7 @@ public function testIssue(): void class DDC512Customer { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -90,6 +91,7 @@ class DDC512OfferItem extends DDC512Item class DDC512Item { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php index 26a8063c720..148d8f56577 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php @@ -48,6 +48,7 @@ class DDC513OfferItem extends DDC513Item class DDC513Item { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -67,6 +68,7 @@ class DDC513Item class DDC513Price { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php index 63e60433a23..8c55cf51b64 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php @@ -53,6 +53,7 @@ public function testIssue(): void class DDC531Item { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php index 5ef558a8aea..9c705b62fff 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php @@ -44,7 +44,10 @@ class DDC588Site */ public $id; - /** @Column(type="string", length=45) */ + /** + * @var string + * @Column(type="string", length=45) + */ protected $name = null; public function __construct($name = '') diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php index 190e917a2de..86da2a24d7d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php @@ -86,6 +86,7 @@ public function testCascadeRemoveOnChildren(): void class DDC599Item { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -124,6 +125,7 @@ class DDC599Subitem extends DDC599Item class DDC599Child { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php index e90534aa099..bf7e9a84ddb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php @@ -141,6 +141,7 @@ public function testCombineIndexBy(): void class DDC618Author { /** + * @var int * @Id * @Column(type="integer") */ @@ -181,7 +182,10 @@ class DDC618Book /** @column(type="string") */ public $title; - /** @ManyToOne(targetEntity="DDC618Author", inversedBy="books") */ + /** + * @var DDC618Author + * @ManyToOne(targetEntity="DDC618Author", inversedBy="books") + */ public $author; public function __construct($title, $author) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php index 588d4000aae..87c14358b77 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php @@ -90,6 +90,7 @@ class DDC6460Embeddable class DDC6460Entity { /** + * @var int * @Id * @GeneratedValue(strategy = "NONE") * @Column(type = "integer") @@ -106,6 +107,7 @@ class DDC6460Entity class DDC6460ParentEntity { /** + * @var int * @Id * @GeneratedValue(strategy = "NONE") * @Column(type = "integer") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php index 88f9f4ec917..4ceb40521a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php @@ -53,10 +53,16 @@ class DDC698Role */ protected $roleID; - /** @Column(name="name", type="string", length=45) */ + /** + * @var string + * @Column(name="name", type="string", length=45) + */ protected $name; - /** @Column(name="shortName", type="string", length=45) */ + /** + * @var string + * @Column(name="shortName", type="string", length=45) + */ protected $shortName; @@ -84,7 +90,10 @@ class DDC698Privilege */ protected $privilegeID; - /** @Column(name="name", type="string", length=45) */ + /** + * @var string + * @Column(name="name", type="string", length=45) + */ protected $name; /** @ManyToMany(targetEntity="DDC698Role", mappedBy="privilege") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php index 10dc6bc6b6b..d396223340e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php @@ -57,10 +57,16 @@ public function getId() */ class DDC719Group extends Entity { - /** @Column(type="string", nullable=false) */ + /** + * @var string + * @Column(type="string", nullable=false) + */ protected $name; - /** @Column(type="string", nullable=true) */ + /** + * @var string + * @Column(type="string", nullable=true) + */ protected $description; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php index dcf82a9b242..216570f2da9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php @@ -170,7 +170,12 @@ public function testBidirectionalMultiMergeManyToMany(): void */ class DDC729A { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @ManyToMany(targetEntity="DDC729B", inversedBy="related") */ @@ -187,7 +192,12 @@ public function __construct() */ class DDC729B { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; /** @ManyToMany(targetEntity="DDC729B", mappedBy="related") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php index 6564f3ceadf..6b41a29bde0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php @@ -115,7 +115,10 @@ class DDC735Review */ protected $id; - /** @ManyToOne(targetEntity="DDC735Product", inversedBy="reviews") */ + /** + * @var DDC735Product + * @ManyToOne(targetEntity="DDC735Product", inversedBy="reviews") + */ protected $product; public function __construct(DDC735Product $product) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php index a698594c7b1..ddd0649c328 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php @@ -115,10 +115,16 @@ abstract class DDC837Super */ class DDC837Class1 extends DDC837Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $title; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $description; /** @OneToOne(targetEntity="DDC837Aggregate") */ @@ -130,10 +136,16 @@ class DDC837Class1 extends DDC837Super */ class DDC837Class2 extends DDC837Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $title; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $description; /** @Column(name="text", type="text") */ @@ -150,10 +162,16 @@ class DDC837Class2 extends DDC837Super */ class DDC837Class3 extends DDC837Super { - /** @Column(name="title", type="string", length=150) */ + /** + * @var string + * @Column(name="title", type="string", length=150) + */ public $apples; - /** @Column(name="content", type="string", length=500) */ + /** + * @var string + * @Column(name="content", type="string", length=500) + */ public $bananas; } @@ -168,7 +186,10 @@ class DDC837Aggregate */ public $id; - /** @Column(name="sysname", type="string") */ + /** + * @var string + * @Column(name="sysname", type="string") + */ protected $sysname; public function __construct($sysname) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php index 41e60253afa..f9f8bc708fb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php @@ -107,6 +107,7 @@ public function testIssue(): void class DDC881User { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -137,6 +138,7 @@ public function setName($name): void class DDC881PhoneNumber { /** + * @var int * @Id * @Column(type="integer") */ @@ -187,6 +189,7 @@ public function getCalls() class DDC881PhoneCall { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="AUTO") @@ -200,7 +203,10 @@ class DDC881PhoneCall * }) */ private $phonenumber; - /** @Column(type="string",nullable=true) */ + /** + * @var string + * @Column(type="string",nullable=true) + */ private $callDate; public function setPhoneNumber(DDC881PhoneNumber $phoneNumber): void diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php index e3c84780a9c..1567a845099 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php @@ -50,7 +50,12 @@ public function testUpdateRootVersion(): void */ class DDC960Root { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ private $id; /** @Column(type="integer") @Version */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php index 03700eb33c3..13ec6ba0069 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php @@ -95,9 +95,17 @@ public function testOneToManyChild(): void */ class DDC992Parent { - /** @Id @GeneratedValue @Column(type="integer") */ + /** + * @var int + * @Id + * @GeneratedValue + * @Column(type="integer") + */ public $id; - /** @ManyToOne(targetEntity="DDC992Parent", inversedBy="childs") */ + /** + * @var DDC992Parent + * @ManyToOne(targetEntity="DDC992Parent", inversedBy="childs") + */ public $parent; /** @OneToMany(targetEntity="DDC992Child", mappedBy="parent") */ public $childs; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php index e8ff6816c64..da8cda393b9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php @@ -108,6 +108,7 @@ private function createData(): void class GH5762Driver { /** + * @var int * @Id * @Column(type="integer") * @GeneratedValue(strategy="NONE") @@ -171,7 +172,10 @@ class GH5762Car */ public $brand; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255) + */ public $model; /** @OneToMany(targetEntity="GH5762DriverRide", mappedBy="car") */ From 15f08ed006968b918cbb91518f5a482732c971a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 13 Feb 2021 19:48:51 +0100 Subject: [PATCH 16/27] Manually fix cs --- tests/Doctrine/Tests/Models/Cache/Action.php | 1 + .../Models/GeoNames/Admin1AlternateName.php | 1 + tests/Doctrine/Tests/Models/GeoNames/City.php | 1 + .../Tests/Models/GeoNames/Country.php | 1 + .../CompositeToOneKeyState.php | 1 + tests/Doctrine/Tests/Models/Taxi/Car.php | 1 + .../ORM/Functional/Ticket/DDC881Test.php | 14 ++++++-- .../ORM/Functional/Ticket/DDC960Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC992Test.php | 32 +++++++++++++++---- .../ORM/Functional/Ticket/GH2947Test.php | 4 ++- .../ORM/Functional/Ticket/GH5762Test.php | 24 +++++++++++--- .../ORM/Functional/Ticket/GH5804Test.php | 5 +++ .../ORM/Functional/Ticket/GH5887Test.php | 2 +- .../ORM/Functional/Ticket/GH6029Test.php | 12 +++++-- 14 files changed, 89 insertions(+), 20 deletions(-) diff --git a/tests/Doctrine/Tests/Models/Cache/Action.php b/tests/Doctrine/Tests/Models/Cache/Action.php index 1eda4e36bcf..36c97f4fac9 100644 --- a/tests/Doctrine/Tests/Models/Cache/Action.php +++ b/tests/Doctrine/Tests/Models/Cache/Action.php @@ -13,6 +13,7 @@ class Action { /** + * @var string * @Id * @Column(type="string") * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php b/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php index 671a38534a4..2611636e24e 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php @@ -12,6 +12,7 @@ class Admin1AlternateName { /** + * @var string * @Id * @Column(type="string", length=25) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/GeoNames/City.php b/tests/Doctrine/Tests/Models/GeoNames/City.php index c715ec6f148..aacd056fbf8 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/City.php +++ b/tests/Doctrine/Tests/Models/GeoNames/City.php @@ -12,6 +12,7 @@ class City { /** + * @var string * @Id * @Column(type="string", length=25) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/GeoNames/Country.php b/tests/Doctrine/Tests/Models/GeoNames/Country.php index 5126f93d3c4..4ff1cc835b7 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Country.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Country.php @@ -12,6 +12,7 @@ class Country { /** + * @var string * @Id * @Column(type="string", length=2) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/MixedToOneIdentity/CompositeToOneKeyState.php b/tests/Doctrine/Tests/Models/MixedToOneIdentity/CompositeToOneKeyState.php index 6393d47712d..a647d0d3cfb 100644 --- a/tests/Doctrine/Tests/Models/MixedToOneIdentity/CompositeToOneKeyState.php +++ b/tests/Doctrine/Tests/Models/MixedToOneIdentity/CompositeToOneKeyState.php @@ -8,6 +8,7 @@ class CompositeToOneKeyState { /** + * @var string * @Id * @Column(type="string") * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/Taxi/Car.php b/tests/Doctrine/Tests/Models/Taxi/Car.php index f58d82f785c..50e54f4238c 100644 --- a/tests/Doctrine/Tests/Models/Taxi/Car.php +++ b/tests/Doctrine/Tests/Models/Taxi/Car.php @@ -11,6 +11,7 @@ class Car { /** + * @var string * @Id * @Column(type="string", length=25) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php index f9f8bc708fb..59b413292e1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Proxy\Proxy; use Doctrine\Tests\OrmFunctionalTestCase; @@ -143,18 +144,24 @@ class DDC881PhoneNumber * @Column(type="integer") */ private $id; + /** + * @var DDC881User * @Id * @ManyToOne(targetEntity="DDC881User",cascade={"all"}) */ private $user; + /** * @var string * @Column(type="string") */ private $phonenumber; - /** @OneToMany(targetEntity="DDC881PhoneCall", mappedBy="phonenumber") */ + /** + * @var Collection + * @OneToMany(targetEntity="DDC881PhoneCall", mappedBy="phonenumber") + */ private $calls; public function __construct() @@ -195,7 +202,9 @@ class DDC881PhoneCall * @GeneratedValue(strategy="AUTO") */ private $id; + /** + * @var DDC881PhoneNumber * @ManyToOne(targetEntity="DDC881PhoneNumber", inversedBy="calls", cascade={"all"}) * @JoinColumns({ * @JoinColumn(name="phonenumber_id", referencedColumnName="id"), @@ -203,6 +212,7 @@ class DDC881PhoneCall * }) */ private $phonenumber; + /** * @var string * @Column(type="string",nullable=true) @@ -214,7 +224,7 @@ public function setPhoneNumber(DDC881PhoneNumber $phoneNumber): void $this->phonenumber = $phoneNumber; } - public function getPhoneNumber() + public function getPhoneNumber(): DDC881PhoneNumber { return $this->phonenumber; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php index 1567a845099..8fe8368c53b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC960Test.php @@ -58,15 +58,19 @@ class DDC960Root */ private $id; - /** @Column(type="integer") @Version */ + /** + * @var int + * @Column(type="integer") + * @Version + */ private $version; - public function getId() + public function getId(): int { return $this->id; } - public function getVersion() + public function getVersion(): int { return $this->version; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php index 13ec6ba0069..4d8f68696fe 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC992Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -102,12 +103,17 @@ class DDC992Parent * @Column(type="integer") */ public $id; + /** * @var DDC992Parent * @ManyToOne(targetEntity="DDC992Parent", inversedBy="childs") */ public $parent; - /** @OneToMany(targetEntity="DDC992Child", mappedBy="parent") */ + + /** + * @var Collection + * @OneToMany(targetEntity="DDC992Child", mappedBy="parent") + */ public $childs; } @@ -116,7 +122,7 @@ class DDC992Parent */ class DDC992Child extends DDC992Parent { - public function childs() + public function childs(): Collection { return $this->childs; } @@ -127,21 +133,33 @@ public function childs() */ class DDC992Role { - public function getRoleID() + public function getRoleID(): int { return $this->roleID; } /** - * @Id @Column(name="roleID", type="integer") - * @GeneratedValue(strategy="AUTO") + * @var int + * @Id + * @Column(name="roleID", type="integer") + * @GeneratedValue(strategy="AUTO") */ public $roleID; - /** @Column (name="name", type="string", length=45) */ + + /** + * @var string + * @Column(name="name", type="string", length=45) + */ public $name; - /** @ManyToMany (targetEntity="DDC992Role", mappedBy="extends") */ + + /** + * @psalm-var Collection + * @ManyToMany (targetEntity="DDC992Role", mappedBy="extends") + */ public $extendedBy; + /** + * @psalm-var Collection * @ManyToMany (targetEntity="DDC992Role", inversedBy="extendedBy") * @JoinTable (name="RoleRelations", * joinColumns={@JoinColumn(name="roleID", referencedColumnName="roleID")}, diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php index 574581f3e02..7acfdeed3c2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH2947Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Cache\ArrayCache; +use Doctrine\ORM\Query; use Doctrine\Tests\OrmFunctionalTestCase; /** @@ -43,7 +44,7 @@ public function testIssue(): void self::assertEquals($initialQueryCount + 3, $this->getCurrentQueryCount()); } - private function createQuery() + private function createQuery(): Query { return $this->_em->createQueryBuilder() ->select('car') @@ -79,6 +80,7 @@ private function updateData(): void class GH2947Car { /** + * @var string * @Id * @Column(type="string", length=25) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php index da8cda393b9..08c749545d8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5762Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\OrmFunctionalTestCase; @@ -52,6 +53,9 @@ public function testIssue(): void self::assertContains('Volvo', $cars); } + /** + * @return mixed + */ private function fetchData() { $this->createData(); @@ -115,13 +119,19 @@ class GH5762Driver */ public $id; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255) + */ public $name; - /** @OneToMany(targetEntity="GH5762DriverRide", mappedBy="driver") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="GH5762DriverRide", mappedBy="driver") + */ public $driverRides; - public function __construct($id, $name) + public function __construct(int $id, string $name) { $this->driverRides = new ArrayCollection(); $this->id = $id; @@ -136,6 +146,7 @@ public function __construct($id, $name) class GH5762DriverRide { /** + * @var GH5762Driver * @Id * @ManyToOne(targetEntity="GH5762Driver", inversedBy="driverRides") * @JoinColumn(name="driver_id", referencedColumnName="id") @@ -143,6 +154,7 @@ class GH5762DriverRide public $driver; /** + * @var GH5762Car * @Id * @ManyToOne(targetEntity="GH5762Car", inversedBy="carRides") * @JoinColumn(name="car", referencedColumnName="brand") @@ -166,6 +178,7 @@ public function __construct(GH5762Driver $driver, GH5762Car $car) class GH5762Car { /** + * @var string * @Id * @Column(type="string", length=25) * @GeneratedValue(strategy="NONE") @@ -178,7 +191,10 @@ class GH5762Car */ public $model; - /** @OneToMany(targetEntity="GH5762DriverRide", mappedBy="car") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="GH5762DriverRide", mappedBy="car") + */ public $carRides; public function __construct($brand, $model) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php index 68c694d2856..9e72fbd21ce 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php @@ -58,6 +58,9 @@ final class GH5804Type extends Type { public const NAME = 'GH5804Type'; + /** + * {@inheritdoc} + */ public function getName() { return self::NAME; @@ -90,6 +93,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) class GH5804Article { /** + * @var string * @Id * @Column(type="GH5804Type") * @GeneratedValue(strategy="CUSTOM") @@ -98,6 +102,7 @@ class GH5804Article public $id; /** + * @var int * @Version * @Column(type="integer") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php index 8784c9f8a4d..078902c46c1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5887Test.php @@ -164,7 +164,7 @@ public function getId(): int return $this->id; } - public function __toString() + public function __toString(): string { return 'non existing id'; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php index 07bf54bd1b8..645e7a4a4e1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\ORMInvalidArgumentException; use Doctrine\Tests\OrmFunctionalTestCase; @@ -89,7 +90,10 @@ class GH6029User */ public $id; - /** @ManyToMany(targetEntity=GH6029Group::class, cascade={"all"}) */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity=GH6029Group::class, cascade={"all"}) + */ public $groups; public function __construct() @@ -133,7 +137,10 @@ class GH6029Product */ public $id; - /** @OneToMany(targetEntity=GH6029Feature::class, mappedBy="product", cascade={"all"}) */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity=GH6029Feature::class, mappedBy="product", cascade={"all"}) + */ public $features; public function __construct() @@ -154,6 +161,7 @@ class GH6029Feature public $id; /** + * @var GH6029Product * @ManyToOne(targetEntity=GH6029Product::class, inversedBy="features") * @JoinColumn(name="product_id", referencedColumnName="id") */ From f83322201771fc8db6b0a18b7d82fd51e893cc02 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 14 Feb 2021 09:23:15 +0100 Subject: [PATCH 17/27] Cs fixes1 (#8475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Housekeeping: CS Query, AbstractQuery, NativeQuery. * Housekeeping: phpcs TreeWalker * Housekeeping: CS Doctrine\ORM\EntityManager * Housekeeping: CS Doctrine\ORM\Cache * Upgrade git-phpcs * Drop unused method parameter * Describe types more precisely Co-authored-by: Grégoire Paris --- .github/workflows/coding-standard.yml | 8 +- lib/Doctrine/ORM/AbstractQuery.php | 24 ++-- .../ORM/Cache/AssociationCacheEntry.php | 8 +- lib/Doctrine/ORM/Cache/CacheFactory.php | 2 +- .../ORM/Cache/CollectionCacheEntry.php | 2 +- lib/Doctrine/ORM/Cache/CollectionCacheKey.php | 8 +- lib/Doctrine/ORM/Cache/CollectionHydrator.php | 2 +- lib/Doctrine/ORM/Cache/DefaultCache.php | 2 +- .../ORM/Cache/DefaultCollectionHydrator.php | 2 +- lib/Doctrine/ORM/Cache/DefaultQueryCache.php | 13 +- lib/Doctrine/ORM/Cache/EntityCacheEntry.php | 10 +- lib/Doctrine/ORM/Cache/EntityCacheKey.php | 6 +- .../Cache/Logging/StatisticsCacheLogger.php | 6 +- .../AbstractCollectionPersister.php | 14 +-- .../Entity/AbstractEntityPersister.php | 10 +- lib/Doctrine/ORM/Cache/QueryCache.php | 2 +- lib/Doctrine/ORM/Cache/QueryCacheEntry.php | 8 +- .../Cache/Region/DefaultMultiGetRegion.php | 3 +- .../ORM/Cache/TimestampCacheEntry.php | 2 +- lib/Doctrine/ORM/EntityManager.php | 28 +++-- lib/Doctrine/ORM/Event/PreUpdateEventArgs.php | 2 +- .../ORM/Internal/CommitOrderCalculator.php | 4 +- lib/Doctrine/ORM/NativeQuery.php | 8 +- lib/Doctrine/ORM/Query.php | 112 +++++++++--------- lib/Doctrine/ORM/Query/TreeWalker.php | 102 ++++++++-------- lib/Doctrine/ORM/UnitOfWork.php | 13 +- 26 files changed, 209 insertions(+), 192 deletions(-) diff --git a/.github/workflows/coding-standard.yml b/.github/workflows/coding-standard.yml index 5ca4f70d055..05cf50375f5 100644 --- a/.github/workflows/coding-standard.yml +++ b/.github/workflows/coding-standard.yml @@ -29,14 +29,14 @@ jobs: - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v1" - - name: "Install git-phpcs" - run: "wget https://github.com/diff-sniffer/git/releases/download/0.3.2/git-phpcs.phar" + - name: "Install diff-sniffer" + run: "wget https://github.com/diff-sniffer/diff-sniffer/releases/download/0.5.1/diff-sniffer.phar" - name: "Fetch head branch" run: "git remote set-branches --add origin $GITHUB_BASE_REF && git fetch origin $GITHUB_BASE_REF" - - name: "Run git-phpcs" - run: "php git-phpcs.phar origin/$GITHUB_BASE_REF...$GITHUB_SHA --report=checkstyle | cs2pr" + - name: "Run diff-sniffer" + run: "php diff-sniffer.phar origin/$GITHUB_BASE_REF...$GITHUB_SHA --report=checkstyle | cs2pr" - name: "Run phpcbf" run: "vendor/bin/phpcbf" diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 2ba30bc4fa8..7e54820d01a 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -795,7 +795,7 @@ public function getResult($hydrationMode = self::HYDRATE_OBJECT) * * Alias for execute(null, HYDRATE_ARRAY). * - * @return array + * @return array */ public function getArrayResult() { @@ -807,7 +807,7 @@ public function getArrayResult() * * Alias for execute(null, HYDRATE_SCALAR). * - * @return array + * @return array */ public function getScalarResult() { @@ -937,7 +937,7 @@ public function hasHint($name) /** * Return the key value map of query hints that are currently set. * - * @return array + * @return array */ public function getHints() { @@ -950,8 +950,8 @@ public function getHints() * * @deprecated * - * @param ArrayCollection|array|null $parameters The query parameters. - * @param string|int|null $hydrationMode The hydration mode to use. + * @param ArrayCollection|mixed[]|null $parameters The query parameters. + * @param string|int|null $hydrationMode The hydration mode to use. * * @return IterableResult */ @@ -1024,8 +1024,8 @@ public function execute($parameters = null, $hydrationMode = null) /** * Execute query ignoring second level cache. * - * @param ArrayCollection|array|null $parameters - * @param string|int|null $hydrationMode + * @param ArrayCollection|mixed[]|null $parameters + * @param string|int|null $hydrationMode * * @return mixed */ @@ -1083,8 +1083,8 @@ private function executeIgnoreQueryCache($parameters = null, $hydrationMode = nu /** * Load from second level cache or executes the query and put into cache. * - * @param ArrayCollection|array|null $parameters - * @param string|int|null $hydrationMode + * @param ArrayCollection|mixed[]|null $parameters + * @param string|int|null $hydrationMode * * @return mixed */ @@ -1224,9 +1224,11 @@ protected function getHash() $query = $this->getSQL(); $hints = $this->getHints(); $params = array_map(function (Parameter $parameter) { + $value = $parameter->getValue(); + // Small optimization - // Does not invoke processParameterValue for scalar values - if (is_scalar($value = $parameter->getValue())) { + // Does not invoke processParameterValue for scalar value + if (is_scalar($value)) { return $value; } diff --git a/lib/Doctrine/ORM/Cache/AssociationCacheEntry.php b/lib/Doctrine/ORM/Cache/AssociationCacheEntry.php index e3db6e0af48..1703eee4c16 100644 --- a/lib/Doctrine/ORM/Cache/AssociationCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/AssociationCacheEntry.php @@ -28,7 +28,7 @@ class AssociationCacheEntry implements CacheEntry /** * READ-ONLY: Public only for performance reasons, it should be considered immutable. * - * @var array The entity identifier + * @var array The entity identifier */ public $identifier; @@ -40,8 +40,8 @@ class AssociationCacheEntry implements CacheEntry public $class; /** - * @param string $class The entity class. - * @param array $identifier The entity identifier. + * @param string $class The entity class. + * @param array $identifier The entity identifier. */ public function __construct($class, array $identifier) { @@ -54,7 +54,7 @@ public function __construct($class, array $identifier) * * This method allow Doctrine\Common\Cache\PhpFileCache compatibility * - * @param array $values array containing property values + * @param array $values array containing property values * * @return AssociationCacheEntry */ diff --git a/lib/Doctrine/ORM/Cache/CacheFactory.php b/lib/Doctrine/ORM/Cache/CacheFactory.php index 6839b043d81..c880fca81d8 100644 --- a/lib/Doctrine/ORM/Cache/CacheFactory.php +++ b/lib/Doctrine/ORM/Cache/CacheFactory.php @@ -88,7 +88,7 @@ public function buildCollectionHydrator(EntityManagerInterface $em, array $mappi /** * Build a cache region * - * @param array $cache The cache configuration. + * @param array $cache The cache configuration. * * @return Region The cache region. */ diff --git a/lib/Doctrine/ORM/Cache/CollectionCacheEntry.php b/lib/Doctrine/ORM/Cache/CollectionCacheEntry.php index 38b49b897ec..9bcf5b5567c 100644 --- a/lib/Doctrine/ORM/Cache/CollectionCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/CollectionCacheEntry.php @@ -45,7 +45,7 @@ public function __construct(array $identifiers) * * This method allows for Doctrine\Common\Cache\PhpFileCache compatibility * - * @param array $values array containing property values + * @param array $values array containing property values * * @return CollectionCacheEntry */ diff --git a/lib/Doctrine/ORM/Cache/CollectionCacheKey.php b/lib/Doctrine/ORM/Cache/CollectionCacheKey.php index bfeee8c31c1..91a2ae9e59f 100644 --- a/lib/Doctrine/ORM/Cache/CollectionCacheKey.php +++ b/lib/Doctrine/ORM/Cache/CollectionCacheKey.php @@ -33,7 +33,7 @@ class CollectionCacheKey extends CacheKey /** * READ-ONLY: Public only for performance reasons, it should be considered immutable. * - * @var array The owner entity identifier + * @var array The owner entity identifier */ public $ownerIdentifier; @@ -52,9 +52,9 @@ class CollectionCacheKey extends CacheKey public $association; /** - * @param string $entityClass The entity class. - * @param string $association The field name that represents the association. - * @param array $ownerIdentifier The identifier of the owning entity. + * @param string $entityClass The entity class. + * @param string $association The field name that represents the association. + * @param array $ownerIdentifier The identifier of the owning entity. */ public function __construct($entityClass, $association, array $ownerIdentifier) { diff --git a/lib/Doctrine/ORM/Cache/CollectionHydrator.php b/lib/Doctrine/ORM/Cache/CollectionHydrator.php index 87a042eff9b..0eb47e65d51 100644 --- a/lib/Doctrine/ORM/Cache/CollectionHydrator.php +++ b/lib/Doctrine/ORM/Cache/CollectionHydrator.php @@ -44,7 +44,7 @@ public function buildCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key * @param CollectionCacheEntry $entry The cached collection entry. * @param PersistentCollection $collection The collection to load the cache into. * - * @return array + * @return mixed[] */ public function loadCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, CollectionCacheEntry $entry, PersistentCollection $collection); } diff --git a/lib/Doctrine/ORM/Cache/DefaultCache.php b/lib/Doctrine/ORM/Cache/DefaultCache.php index f8b7b46a001..54c933799cc 100644 --- a/lib/Doctrine/ORM/Cache/DefaultCache.php +++ b/lib/Doctrine/ORM/Cache/DefaultCache.php @@ -310,7 +310,7 @@ private function buildCollectionCacheKey(ClassMetadata $metadata, $association, * @param ClassMetadata $metadata The entity metadata. * @param mixed $identifier The entity identifier. * - * @return array + * @return array */ private function toIdentifierArray(ClassMetadata $metadata, $identifier) { diff --git a/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php b/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php index a4b16451ba6..99a2bd4e618 100644 --- a/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php +++ b/lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php @@ -78,13 +78,13 @@ public function loadCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key, $targetRegion = $targetPersister->getCacheRegion(); $list = []; + /** @var EntityCacheEntry[]|null $entityEntries */ $entityEntries = $targetRegion->getMultiple($entry); if ($entityEntries === null) { return null; } - /** @var EntityCacheEntry[] $entityEntries */ foreach ($entityEntries as $index => $entityEntry) { $list[$index] = $this->uow->createEntity($entityEntry->class, $entityEntry->resolveAssociationEntries($this->em), self::$hints); } diff --git a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php index f2884b2f29a..8d31931dbac 100644 --- a/lib/Doctrine/ORM/Cache/DefaultQueryCache.php +++ b/lib/Doctrine/ORM/Cache/DefaultQueryCache.php @@ -151,7 +151,10 @@ public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = [] $assocMetadata = $this->em->getClassMetadata($assoc['targetEntity']); if ($assoc['type'] & ClassMetadata::TO_ONE) { - if (($assocEntry = $assocRegion->get($assocKey = new EntityCacheKey($assocMetadata->rootEntityName, $assoc['identifier']))) === null) { + $assocKey = new EntityCacheKey($assocMetadata->rootEntityName, $assoc['identifier']); + $assocEntry = $assocRegion->get($assocKey); + + if ($assocEntry === null) { if ($this->cacheLogger !== null) { $this->cacheLogger->entityCacheMiss($assocRegion->getName(), $assocKey); } @@ -398,7 +401,7 @@ private function storeAssociationCache(QueryCacheKey $key, array $assoc, $assocV * @param string $assocAlias * @param object $entity * - * @return array|object + * @return array|object */ private function getAssociationValue(ResultSetMapping $rsm, $assocAlias, $entity) { @@ -422,10 +425,10 @@ private function getAssociationValue(ResultSetMapping $rsm, $assocAlias, $entity } /** - * @param mixed $value - * @param array $path + * @param mixed $value + * @param array $path * - * @return array|object|null + * @return array|object|null */ private function getAssociationPathValue($value, array $path) { diff --git a/lib/Doctrine/ORM/Cache/EntityCacheEntry.php b/lib/Doctrine/ORM/Cache/EntityCacheEntry.php index 81b00ff72c2..ac95cb8df7b 100644 --- a/lib/Doctrine/ORM/Cache/EntityCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/EntityCacheEntry.php @@ -32,7 +32,7 @@ class EntityCacheEntry implements CacheEntry /** * READ-ONLY: Public only for performance reasons, it should be considered immutable. * - * @var array The entity map data + * @var array The entity map data */ public $data; @@ -44,8 +44,8 @@ class EntityCacheEntry implements CacheEntry public $class; /** - * @param string $class The entity class. - * @param array $data The entity data. + * @param string $class The entity class. + * @param array $data The entity data. */ public function __construct($class, array $data) { @@ -58,7 +58,7 @@ public function __construct($class, array $data) * * This method allow Doctrine\Common\Cache\PhpFileCache compatibility * - * @param array $values array containing property values + * @param array $values array containing property values * * @return EntityCacheEntry */ @@ -70,7 +70,7 @@ public static function __set_state(array $values) /** * Retrieves the entity data resolving cache entries * - * @return array + * @return array */ public function resolveAssociationEntries(EntityManagerInterface $em) { diff --git a/lib/Doctrine/ORM/Cache/EntityCacheKey.php b/lib/Doctrine/ORM/Cache/EntityCacheKey.php index ee2d1471f67..e9aef0bfb09 100644 --- a/lib/Doctrine/ORM/Cache/EntityCacheKey.php +++ b/lib/Doctrine/ORM/Cache/EntityCacheKey.php @@ -33,7 +33,7 @@ class EntityCacheKey extends CacheKey /** * READ-ONLY: Public only for performance reasons, it should be considered immutable. * - * @var array The entity identifier + * @var array The entity identifier */ public $identifier; @@ -45,8 +45,8 @@ class EntityCacheKey extends CacheKey public $entityClass; /** - * @param string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class. - * @param array $identifier The entity identifier + * @param string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class. + * @param array $identifier The entity identifier */ public function __construct($entityClass, array $identifier) { diff --git a/lib/Doctrine/ORM/Cache/Logging/StatisticsCacheLogger.php b/lib/Doctrine/ORM/Cache/Logging/StatisticsCacheLogger.php index 879c3eeb27f..6234063f164 100644 --- a/lib/Doctrine/ORM/Cache/Logging/StatisticsCacheLogger.php +++ b/lib/Doctrine/ORM/Cache/Logging/StatisticsCacheLogger.php @@ -167,7 +167,7 @@ public function getRegionPutCount($regionName) } /** - * @return array + * @return array */ public function getRegionsMiss() { @@ -175,7 +175,7 @@ public function getRegionsMiss() } /** - * @return array + * @return array */ public function getRegionsHit() { @@ -183,7 +183,7 @@ public function getRegionsHit() } /** - * @return array + * @return array */ public function getRegionsPut() { diff --git a/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php b/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php index 941a9b8a2e2..7c43a965470 100644 --- a/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php +++ b/lib/Doctrine/ORM/Cache/Persister/Collection/AbstractCollectionPersister.php @@ -128,15 +128,13 @@ public function getTargetEntityMetadata() */ public function loadCollectionCache(PersistentCollection $collection, CollectionCacheKey $key) { - if (($cache = $this->region->get($key)) === null) { - return null; - } + $cache = $this->region->get($key); - if (($cache = $this->hydrator->loadCacheEntry($this->sourceEntity, $key, $cache, $collection)) === null) { + if ($cache === null) { return null; } - return $cache; + return $this->hydrator->loadCacheEntry($this->sourceEntity, $key, $cache, $collection); } /** @@ -144,11 +142,11 @@ public function loadCollectionCache(PersistentCollection $collection, Collection */ public function storeCollectionCache(CollectionCacheKey $key, $elements) { - /** @var CachedEntityPersister $targetPersister */ $associationMapping = $this->sourceEntity->associationMappings[$key->association]; $targetPersister = $this->uow->getEntityPersister($this->targetEntity->rootEntityName); - $targetRegion = $targetPersister->getCacheRegion(); - $targetHydrator = $targetPersister->getEntityHydrator(); + assert($targetPersister instanceof CachedEntityPersister); + $targetRegion = $targetPersister->getCacheRegion(); + $targetHydrator = $targetPersister->getEntityHydrator(); // Only preserve ordering if association configured it if (! (isset($associationMapping['indexBy']) && $associationMapping['indexBy'])) { diff --git a/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php b/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php index 53d8c7614e9..5e96c309c63 100644 --- a/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php +++ b/lib/Doctrine/ORM/Cache/Persister/Entity/AbstractEntityPersister.php @@ -84,7 +84,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister /** * Associations configured as FETCH_EAGER, as well as all inverse one-to-one associations. * - * @var array|null + * @var array|null */ protected $joinedAssociations; @@ -364,7 +364,9 @@ public function load(array $criteria, $entity = null, $assoc = null, array $hint return $result[0]; } - if (($result = $this->persister->load($criteria, $entity, $assoc, $hints, $lockMode, $limit, $orderBy)) === null) { + $result = $this->persister->load($criteria, $entity, $assoc, $hints, $lockMode, $limit, $orderBy); + + if ($result === null) { return null; } @@ -617,8 +619,8 @@ public function refresh(array $id, $entity, $lockMode = null) } /** - * @param array $association - * @param array $ownerId + * @param array $association + * @param array $ownerId * * @return CollectionCacheKey */ diff --git a/lib/Doctrine/ORM/Cache/QueryCache.php b/lib/Doctrine/ORM/Cache/QueryCache.php index 9a3c6e82701..24dba30f74e 100644 --- a/lib/Doctrine/ORM/Cache/QueryCache.php +++ b/lib/Doctrine/ORM/Cache/QueryCache.php @@ -44,7 +44,7 @@ public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $h /** * @param mixed[] $hints * - * @return array|null + * @return mixed[]|null */ public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = []); diff --git a/lib/Doctrine/ORM/Cache/QueryCacheEntry.php b/lib/Doctrine/ORM/Cache/QueryCacheEntry.php index cc4c964d6f0..6361cf1a929 100644 --- a/lib/Doctrine/ORM/Cache/QueryCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/QueryCacheEntry.php @@ -30,7 +30,7 @@ class QueryCacheEntry implements CacheEntry /** * READ-ONLY: Public only for performance reasons, it should be considered immutable. * - * @var array List of entity identifiers + * @var array List of entity identifiers */ public $result; @@ -42,8 +42,8 @@ class QueryCacheEntry implements CacheEntry public $time; /** - * @param array $result - * @param float $time + * @param array $result + * @param float $time */ public function __construct($result, $time = null) { @@ -52,7 +52,7 @@ public function __construct($result, $time = null) } /** - * @param array $values + * @param array $values * * @return QueryCacheEntry */ diff --git a/lib/Doctrine/ORM/Cache/Region/DefaultMultiGetRegion.php b/lib/Doctrine/ORM/Cache/Region/DefaultMultiGetRegion.php index 61ae0de8733..1ce47f138fd 100644 --- a/lib/Doctrine/ORM/Cache/Region/DefaultMultiGetRegion.php +++ b/lib/Doctrine/ORM/Cache/Region/DefaultMultiGetRegion.php @@ -25,6 +25,7 @@ use Doctrine\ORM\Cache\CacheEntry; use Doctrine\ORM\Cache\CollectionCacheEntry; +use function assert; use function count; /** @@ -47,7 +48,7 @@ class DefaultMultiGetRegion extends DefaultRegion */ public function __construct($name, MultiGetCache $cache, $lifetime = 0) { - /** @var Cache $cache */ + assert($cache instanceof Cache); parent::__construct($name, $cache, $lifetime); } diff --git a/lib/Doctrine/ORM/Cache/TimestampCacheEntry.php b/lib/Doctrine/ORM/Cache/TimestampCacheEntry.php index f803429fe17..a399f248865 100644 --- a/lib/Doctrine/ORM/Cache/TimestampCacheEntry.php +++ b/lib/Doctrine/ORM/Cache/TimestampCacheEntry.php @@ -47,7 +47,7 @@ public function __construct($time = null) * * This method allow Doctrine\Common\Cache\PhpFileCache compatibility * - * @param array $values array containing property values + * @param array $values array containing property values * * @return TimestampCacheEntry */ diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index 81da7f6957b..70bbab82994 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -441,8 +441,10 @@ public function find($className, $id, $lockMode = null, $lockVersion = null) $unitOfWork = $this->getUnitOfWork(); + $entity = $unitOfWork->tryGetById($sortedId, $class->rootEntityName); + // Check identity map first - if (($entity = $unitOfWork->tryGetById($sortedId, $class->rootEntityName)) !== false) { + if ($entity !== false) { if (! ($entity instanceof $class->name)) { return null; } @@ -508,8 +510,10 @@ public function getReference($entityName, $id) throw ORMException::unrecognizedIdentifierFields($class->name, array_keys($id)); } + $entity = $this->unitOfWork->tryGetById($sortedId, $class->rootEntityName); + // Check identity map first, if its already in there just return it. - if (($entity = $this->unitOfWork->tryGetById($sortedId, $class->rootEntityName)) !== false) { + if ($entity !== false) { return $entity instanceof $class->name ? $entity : null; } @@ -531,8 +535,10 @@ public function getPartialReference($entityName, $identifier) { $class = $this->metadataFactory->getMetadataFor(ltrim($entityName, '\\')); + $entity = $this->unitOfWork->tryGetById($identifier, $class->rootEntityName); + // Check identity map first, if its already in there just return it. - if (($entity = $this->unitOfWork->tryGetById($identifier, $class->rootEntityName)) !== false) { + if ($entity !== false) { return $entity instanceof $class->name ? $entity : null; } @@ -842,7 +848,9 @@ public function newHydrator($hydrationMode) return new Internal\Hydration\SimpleObjectHydrator($this); default: - if (($class = $this->config->getCustomHydrationMode($hydrationMode)) !== null) { + $class = $this->config->getCustomHydrationMode($hydrationMode); + + if ($class !== null) { return new $class($this); } } @@ -869,9 +877,9 @@ public function initializeObject($obj) /** * Factory method to create EntityManager instances. * - * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. - * @param Configuration $config The Configuration instance to use. - * @param EventManager $eventManager The EventManager instance to use. + * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. + * @param Configuration $config The Configuration instance to use. + * @param EventManager $eventManager The EventManager instance to use. * * @return EntityManager The created EntityManager. * @@ -892,9 +900,9 @@ public static function create($connection, Configuration $config, ?EventManager /** * Factory method to create Connection instances. * - * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. - * @param Configuration $config The Configuration instance to use. - * @param EventManager $eventManager The EventManager instance to use. + * @param array|Connection $connection An array with the connection parameters or an existing Connection instance. + * @param Configuration $config The Configuration instance to use. + * @param EventManager $eventManager The EventManager instance to use. * * @return Connection * diff --git a/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php b/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php index ca0a116e0f8..0f08dec473f 100644 --- a/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php +++ b/lib/Doctrine/ORM/Event/PreUpdateEventArgs.php @@ -48,7 +48,7 @@ public function __construct($entity, EntityManagerInterface $em, array &$changeS /** * Retrieves entity changeset. * - * @return array + * @return array> */ public function getEntityChangeSet() { diff --git a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php index db769f3a09f..589a3a08776 100644 --- a/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php +++ b/lib/Doctrine/ORM/Internal/CommitOrderCalculator.php @@ -59,7 +59,7 @@ class CommitOrderCalculator /** * Volatile variable holding calculated nodes during sorting process. * - * @var array + * @psalm-var list */ private $sortedNodeList = []; @@ -122,7 +122,7 @@ public function addDependency($fromHash, $toHash, $weight) * * {@internal Highly performance-sensitive method.} * - * @return array + * @psalm-return list */ public function sort() { diff --git a/lib/Doctrine/ORM/NativeQuery.php b/lib/Doctrine/ORM/NativeQuery.php index 7ee571a57c7..d39f4a6890a 100644 --- a/lib/Doctrine/ORM/NativeQuery.php +++ b/lib/Doctrine/ORM/NativeQuery.php @@ -31,7 +31,7 @@ final class NativeQuery extends AbstractQuery { /** @var string */ - private $_sql; + private $sql; /** * Sets the SQL of the query. @@ -42,7 +42,7 @@ final class NativeQuery extends AbstractQuery */ public function setSQL($sql): self { - $this->_sql = $sql; + $this->sql = $sql; return $this; } @@ -56,7 +56,7 @@ public function setSQL($sql): self */ public function getSQL() { - return $this->_sql; + return $this->sql; } /** @@ -87,7 +87,7 @@ protected function _doExecute() } return $this->_em->getConnection()->executeQuery( - $this->_sql, + $this->sql, $parameters, $types, $this->_queryCacheProfile diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index 7f5ad59bc07..a26861da8b8 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -23,6 +23,7 @@ use Doctrine\Common\Cache\Cache; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\DBAL\LockMode; +use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Internal\Hydration\IterableResult; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query\AST\DeleteStatement; @@ -126,65 +127,65 @@ final class Query extends AbstractQuery /** * A snapshot of the parameter types the query was parsed with. * - * @var array + * @var array */ - private $_parsedTypes = []; + private $parsedTypes = []; /** * Cached DQL query. * * @var string|null */ - private $_dql = null; + private $dql = null; /** * The parser result that holds DQL => SQL information. * * @var ParserResult */ - private $_parserResult; + private $parserResult; /** * The first result to return (the "offset"). * * @var int|null */ - private $_firstResult = null; + private $firstResult = null; /** * The maximum number of results to return (the "limit"). * * @var int|null */ - private $_maxResults = null; + private $maxResults = null; /** * The cache driver used for caching queries. * * @var Cache|null */ - private $_queryCache; + private $queryCache; /** * Whether or not expire the query cache. * * @var bool */ - private $_expireQueryCache = false; + private $expireQueryCache = false; /** * The query cache lifetime. * * @var int */ - private $_queryCacheTTL; + private $queryCacheTTL; /** * Whether to use a query cache, if available. Defaults to TRUE. * * @var bool */ - private $_useQueryCache = true; + private $useQueryCache = true; /** * Gets the SQL query/queries that correspond to this DQL query. @@ -195,7 +196,7 @@ final class Query extends AbstractQuery */ public function getSQL() { - return $this->_parse()->getSqlExecutor()->getSqlStatements(); + return $this->parse()->getSqlExecutor()->getSqlStatements(); } /** @@ -217,7 +218,7 @@ protected function getResultSetMapping() { // parse query or load from cache if ($this->_resultSetMapping === null) { - $this->_resultSetMapping = $this->_parse()->getResultSetMapping(); + $this->_resultSetMapping = $this->parse()->getResultSetMapping(); } return $this->_resultSetMapping; @@ -230,7 +231,7 @@ protected function getResultSetMapping() * * @return ParserResult */ - private function _parse() + private function parse() { $types = []; @@ -240,41 +241,41 @@ private function _parse() } // Return previous parser result if the query and the filter collection are both clean - if ($this->_state === self::STATE_CLEAN && $this->_parsedTypes === $types && $this->_em->isFiltersStateClean()) { - return $this->_parserResult; + if ($this->_state === self::STATE_CLEAN && $this->parsedTypes === $types && $this->_em->isFiltersStateClean()) { + return $this->parserResult; } - $this->_state = self::STATE_CLEAN; - $this->_parsedTypes = $types; + $this->_state = self::STATE_CLEAN; + $this->parsedTypes = $types; $queryCache = $this->getQueryCacheDriver(); // Check query cache. - if (! ($this->_useQueryCache && $queryCache)) { + if (! ($this->useQueryCache && $queryCache)) { $parser = new Parser($this); - $this->_parserResult = $parser->parse(); + $this->parserResult = $parser->parse(); - return $this->_parserResult; + return $this->parserResult; } $hash = $this->_getQueryCacheId(); - $cached = $this->_expireQueryCache ? false : $queryCache->fetch($hash); + $cached = $this->expireQueryCache ? false : $queryCache->fetch($hash); if ($cached instanceof ParserResult) { // Cache hit. - $this->_parserResult = $cached; + $this->parserResult = $cached; - return $this->_parserResult; + return $this->parserResult; } // Cache miss. $parser = new Parser($this); - $this->_parserResult = $parser->parse(); + $this->parserResult = $parser->parse(); - $queryCache->save($hash, $this->_parserResult, $this->_queryCacheTTL); + $queryCache->save($hash, $this->parserResult, $this->queryCacheTTL); - return $this->_parserResult; + return $this->parserResult; } /** @@ -282,7 +283,7 @@ private function _parse() */ protected function _doExecute() { - $executor = $this->_parse()->getSqlExecutor(); + $executor = $this->parse()->getSqlExecutor(); if ($this->_queryCacheProfile) { $executor->setQueryCacheProfile($this->_queryCacheProfile); @@ -291,11 +292,11 @@ protected function _doExecute() } if ($this->_resultSetMapping === null) { - $this->_resultSetMapping = $this->_parserResult->getResultSetMapping(); + $this->_resultSetMapping = $this->parserResult->getResultSetMapping(); } // Prepare parameters - $paramMappings = $this->_parserResult->getParameterMappings(); + $paramMappings = $this->parserResult->getParameterMappings(); $paramCount = count($this->parameters); $mappingCount = count($paramMappings); @@ -324,6 +325,11 @@ protected function _doExecute() return $executor->execute($this->_em->getConnection(), $sqlParams, $types); } + /** + * @param array $sqlParams + * @param array $types + * @param array $connectionParams + */ private function evictResultSetCache( AbstractSqlExecutor $executor, array $sqlParams, @@ -365,7 +371,7 @@ private function evictEntityCacheRegion() /** * Processes query parameter mappings. * - * @param array $paramMappings + * @param Parameter[] $paramMappings * * @return mixed[][] * @@ -373,7 +379,7 @@ private function evictEntityCacheRegion() * * @psalm-return array{0: list, 1: array} */ - private function processParameterMappings($paramMappings): array + private function processParameterMappings(array $paramMappings): array { $sqlParams = []; $types = []; @@ -463,7 +469,7 @@ private function resolveParameterValue(Parameter $parameter): array */ public function setQueryCacheDriver($queryCache): self { - $this->_queryCache = $queryCache; + $this->queryCache = $queryCache; return $this; } @@ -477,7 +483,7 @@ public function setQueryCacheDriver($queryCache): self */ public function useQueryCache($bool): self { - $this->_useQueryCache = $bool; + $this->useQueryCache = $bool; return $this; } @@ -490,8 +496,8 @@ public function useQueryCache($bool): self */ public function getQueryCacheDriver() { - if ($this->_queryCache) { - return $this->_queryCache; + if ($this->queryCache) { + return $this->queryCache; } return $this->_em->getConfiguration()->getQueryCacheImpl(); @@ -510,7 +516,7 @@ public function setQueryCacheLifetime($timeToLive): self $timeToLive = (int) $timeToLive; } - $this->_queryCacheTTL = $timeToLive; + $this->queryCacheTTL = $timeToLive; return $this; } @@ -522,7 +528,7 @@ public function setQueryCacheLifetime($timeToLive): self */ public function getQueryCacheLifetime() { - return $this->_queryCacheTTL; + return $this->queryCacheTTL; } /** @@ -534,7 +540,7 @@ public function getQueryCacheLifetime() */ public function expireQueryCache($expire = true): self { - $this->_expireQueryCache = $expire; + $this->expireQueryCache = $expire; return $this; } @@ -546,7 +552,7 @@ public function expireQueryCache($expire = true): self */ public function getExpireQueryCache() { - return $this->_expireQueryCache; + return $this->expireQueryCache; } /** @@ -556,7 +562,7 @@ public function free() { parent::free(); - $this->_dql = null; + $this->dql = null; $this->_state = self::STATE_CLEAN; } @@ -568,7 +574,7 @@ public function free() public function setDQL($dqlQuery): self { if ($dqlQuery !== null) { - $this->_dql = $dqlQuery; + $this->dql = $dqlQuery; $this->_state = self::STATE_DIRTY; } @@ -582,7 +588,7 @@ public function setDQL($dqlQuery): self */ public function getDQL() { - return $this->_dql; + return $this->dql; } /** @@ -621,8 +627,8 @@ public function contains($dql) */ public function setFirstResult($firstResult): self { - $this->_firstResult = $firstResult; - $this->_state = self::STATE_DIRTY; + $this->firstResult = $firstResult; + $this->_state = self::STATE_DIRTY; return $this; } @@ -635,7 +641,7 @@ public function setFirstResult($firstResult): self */ public function getFirstResult() { - return $this->_firstResult; + return $this->firstResult; } /** @@ -647,8 +653,8 @@ public function getFirstResult() */ public function setMaxResults($maxResults): self { - $this->_maxResults = $maxResults; - $this->_state = self::STATE_DIRTY; + $this->maxResults = $maxResults; + $this->_state = self::STATE_DIRTY; return $this; } @@ -661,15 +667,15 @@ public function setMaxResults($maxResults): self */ public function getMaxResults() { - return $this->_maxResults; + return $this->maxResults; } /** * Executes the query and returns an IterableResult that can be used to incrementally * iterated over the result. * - * @param ArrayCollection|array|null $parameters The query parameters. - * @param string|int $hydrationMode The hydration mode to use. + * @param ArrayCollection|mixed[]|null $parameters The query parameters. + * @param string|int $hydrationMode The hydration mode to use. * * @return IterableResult */ @@ -764,8 +770,8 @@ protected function _getQueryCacheId() $this->getDQL() . serialize($this->_hints) . '&platform=' . $platform . ($this->_em->hasFilters() ? $this->_em->getFilters()->getHash() : '') . - '&firstResult=' . $this->_firstResult . '&maxResult=' . $this->_maxResults . - '&hydrationMode=' . $this->_hydrationMode . '&types=' . serialize($this->_parsedTypes) . 'DOCTRINE_QUERY_CACHE_SALT' + '&firstResult=' . $this->firstResult . '&maxResult=' . $this->maxResults . + '&hydrationMode=' . $this->_hydrationMode . '&types=' . serialize($this->parsedTypes) . 'DOCTRINE_QUERY_CACHE_SALT' ); } @@ -774,7 +780,7 @@ protected function _getQueryCacheId() */ protected function getHash() { - return sha1(parent::getHash() . '-' . $this->_firstResult . '-' . $this->_maxResults); + return sha1(parent::getHash() . '-' . $this->firstResult . '-' . $this->maxResults); } /** diff --git a/lib/Doctrine/ORM/Query/TreeWalker.php b/lib/Doctrine/ORM/Query/TreeWalker.php index a8ab903912f..8cc8521fdf0 100644 --- a/lib/Doctrine/ORM/Query/TreeWalker.php +++ b/lib/Doctrine/ORM/Query/TreeWalker.php @@ -39,15 +39,17 @@ public function __construct($query, $parserResult, array $queryComponents); /** * Returns internal queryComponents array. * - * @return array + * @return array> + * + * @psalm-var array */ public function getQueryComponents(); /** * Sets or overrides a query component for a given dql alias. * - * @param string $dqlAlias The DQL alias. - * @param array $queryComponent + * @param string $dqlAlias The DQL alias. + * @param array $queryComponent * * @return void */ @@ -58,7 +60,7 @@ public function setQueryComponent($dqlAlias, array $queryComponent); * * @return string The SQL. */ - function walkSelectStatement(AST\SelectStatement $AST); + public function walkSelectStatement(AST\SelectStatement $AST); /** * Walks down a SelectClause AST node, thereby generating the appropriate SQL. @@ -67,7 +69,7 @@ function walkSelectStatement(AST\SelectStatement $AST); * * @return string The SQL. */ - function walkSelectClause($selectClause); + public function walkSelectClause($selectClause); /** * Walks down a FromClause AST node, thereby generating the appropriate SQL. @@ -76,7 +78,7 @@ function walkSelectClause($selectClause); * * @return string The SQL. */ - function walkFromClause($fromClause); + public function walkFromClause($fromClause); /** * Walks down a FunctionNode AST node, thereby generating the appropriate SQL. @@ -85,7 +87,7 @@ function walkFromClause($fromClause); * * @return string The SQL. */ - function walkFunction($function); + public function walkFunction($function); /** * Walks down an OrderByClause AST node, thereby generating the appropriate SQL. @@ -94,7 +96,7 @@ function walkFunction($function); * * @return string The SQL. */ - function walkOrderByClause($orderByClause); + public function walkOrderByClause($orderByClause); /** * Walks down an OrderByItem AST node, thereby generating the appropriate SQL. @@ -103,7 +105,7 @@ function walkOrderByClause($orderByClause); * * @return string The SQL. */ - function walkOrderByItem($orderByItem); + public function walkOrderByItem($orderByItem); /** * Walks down a HavingClause AST node, thereby generating the appropriate SQL. @@ -112,7 +114,7 @@ function walkOrderByItem($orderByItem); * * @return string The SQL. */ - function walkHavingClause($havingClause); + public function walkHavingClause($havingClause); /** * Walks down a Join AST node and creates the corresponding SQL. @@ -121,7 +123,7 @@ function walkHavingClause($havingClause); * * @return string The SQL. */ - function walkJoin($join); + public function walkJoin($join); /** * Walks down a SelectExpression AST node and generates the corresponding SQL. @@ -130,7 +132,7 @@ function walkJoin($join); * * @return string The SQL. */ - function walkSelectExpression($selectExpression); + public function walkSelectExpression($selectExpression); /** * Walks down a QuantifiedExpression AST node, thereby generating the appropriate SQL. @@ -139,7 +141,7 @@ function walkSelectExpression($selectExpression); * * @return string The SQL. */ - function walkQuantifiedExpression($qExpr); + public function walkQuantifiedExpression($qExpr); /** * Walks down a Subselect AST node, thereby generating the appropriate SQL. @@ -148,7 +150,7 @@ function walkQuantifiedExpression($qExpr); * * @return string The SQL. */ - function walkSubselect($subselect); + public function walkSubselect($subselect); /** * Walks down a SubselectFromClause AST node, thereby generating the appropriate SQL. @@ -157,7 +159,7 @@ function walkSubselect($subselect); * * @return string The SQL. */ - function walkSubselectFromClause($subselectFromClause); + public function walkSubselectFromClause($subselectFromClause); /** * Walks down a SimpleSelectClause AST node, thereby generating the appropriate SQL. @@ -166,7 +168,7 @@ function walkSubselectFromClause($subselectFromClause); * * @return string The SQL. */ - function walkSimpleSelectClause($simpleSelectClause); + public function walkSimpleSelectClause($simpleSelectClause); /** * Walks down a SimpleSelectExpression AST node, thereby generating the appropriate SQL. @@ -175,7 +177,7 @@ function walkSimpleSelectClause($simpleSelectClause); * * @return string The SQL. */ - function walkSimpleSelectExpression($simpleSelectExpression); + public function walkSimpleSelectExpression($simpleSelectExpression); /** * Walks down an AggregateExpression AST node, thereby generating the appropriate SQL. @@ -184,7 +186,7 @@ function walkSimpleSelectExpression($simpleSelectExpression); * * @return string The SQL. */ - function walkAggregateExpression($aggExpression); + public function walkAggregateExpression($aggExpression); /** * Walks down a GroupByClause AST node, thereby generating the appropriate SQL. @@ -193,7 +195,7 @@ function walkAggregateExpression($aggExpression); * * @return string The SQL. */ - function walkGroupByClause($groupByClause); + public function walkGroupByClause($groupByClause); /** * Walks down a GroupByItem AST node, thereby generating the appropriate SQL. @@ -202,28 +204,28 @@ function walkGroupByClause($groupByClause); * * @return string The SQL. */ - function walkGroupByItem($groupByItem); + public function walkGroupByItem($groupByItem); /** * Walks down an UpdateStatement AST node, thereby generating the appropriate SQL. * * @return string The SQL. */ - function walkUpdateStatement(AST\UpdateStatement $AST); + public function walkUpdateStatement(AST\UpdateStatement $AST); /** * Walks down a DeleteStatement AST node, thereby generating the appropriate SQL. * * @return string The SQL. */ - function walkDeleteStatement(AST\DeleteStatement $AST); + public function walkDeleteStatement(AST\DeleteStatement $AST); /** * Walks down a DeleteClause AST node, thereby generating the appropriate SQL. * * @return string The SQL. */ - function walkDeleteClause(AST\DeleteClause $deleteClause); + public function walkDeleteClause(AST\DeleteClause $deleteClause); /** * Walks down an UpdateClause AST node, thereby generating the appropriate SQL. @@ -232,7 +234,7 @@ function walkDeleteClause(AST\DeleteClause $deleteClause); * * @return string The SQL. */ - function walkUpdateClause($updateClause); + public function walkUpdateClause($updateClause); /** * Walks down an UpdateItem AST node, thereby generating the appropriate SQL. @@ -241,7 +243,7 @@ function walkUpdateClause($updateClause); * * @return string The SQL. */ - function walkUpdateItem($updateItem); + public function walkUpdateItem($updateItem); /** * Walks down a WhereClause AST node, thereby generating the appropriate SQL. @@ -251,7 +253,7 @@ function walkUpdateItem($updateItem); * * @return string The SQL. */ - function walkWhereClause($whereClause); + public function walkWhereClause($whereClause); /** * Walk down a ConditionalExpression AST node, thereby generating the appropriate SQL. @@ -260,7 +262,7 @@ function walkWhereClause($whereClause); * * @return string The SQL. */ - function walkConditionalExpression($condExpr); + public function walkConditionalExpression($condExpr); /** * Walks down a ConditionalTerm AST node, thereby generating the appropriate SQL. @@ -269,7 +271,7 @@ function walkConditionalExpression($condExpr); * * @return string The SQL. */ - function walkConditionalTerm($condTerm); + public function walkConditionalTerm($condTerm); /** * Walks down a ConditionalFactor AST node, thereby generating the appropriate SQL. @@ -278,7 +280,7 @@ function walkConditionalTerm($condTerm); * * @return string The SQL. */ - function walkConditionalFactor($factor); + public function walkConditionalFactor($factor); /** * Walks down a ConditionalPrimary AST node, thereby generating the appropriate SQL. @@ -287,7 +289,7 @@ function walkConditionalFactor($factor); * * @return string The SQL. */ - function walkConditionalPrimary($primary); + public function walkConditionalPrimary($primary); /** * Walks down an ExistsExpression AST node, thereby generating the appropriate SQL. @@ -296,7 +298,7 @@ function walkConditionalPrimary($primary); * * @return string The SQL. */ - function walkExistsExpression($existsExpr); + public function walkExistsExpression($existsExpr); /** * Walks down a CollectionMemberExpression AST node, thereby generating the appropriate SQL. @@ -305,7 +307,7 @@ function walkExistsExpression($existsExpr); * * @return string The SQL. */ - function walkCollectionMemberExpression($collMemberExpr); + public function walkCollectionMemberExpression($collMemberExpr); /** * Walks down an EmptyCollectionComparisonExpression AST node, thereby generating the appropriate SQL. @@ -314,7 +316,7 @@ function walkCollectionMemberExpression($collMemberExpr); * * @return string The SQL. */ - function walkEmptyCollectionComparisonExpression($emptyCollCompExpr); + public function walkEmptyCollectionComparisonExpression($emptyCollCompExpr); /** * Walks down a NullComparisonExpression AST node, thereby generating the appropriate SQL. @@ -323,7 +325,7 @@ function walkEmptyCollectionComparisonExpression($emptyCollCompExpr); * * @return string The SQL. */ - function walkNullComparisonExpression($nullCompExpr); + public function walkNullComparisonExpression($nullCompExpr); /** * Walks down an InExpression AST node, thereby generating the appropriate SQL. @@ -332,7 +334,7 @@ function walkNullComparisonExpression($nullCompExpr); * * @return string The SQL. */ - function walkInExpression($inExpr); + public function walkInExpression($inExpr); /** * Walks down an InstanceOfExpression AST node, thereby generating the appropriate SQL. @@ -341,7 +343,7 @@ function walkInExpression($inExpr); * * @return string The SQL. */ - function walkInstanceOfExpression($instanceOfExpr); + public function walkInstanceOfExpression($instanceOfExpr); /** * Walks down a literal that represents an AST node, thereby generating the appropriate SQL. @@ -350,7 +352,7 @@ function walkInstanceOfExpression($instanceOfExpr); * * @return string The SQL. */ - function walkLiteral($literal); + public function walkLiteral($literal); /** * Walks down a BetweenExpression AST node, thereby generating the appropriate SQL. @@ -359,7 +361,7 @@ function walkLiteral($literal); * * @return string The SQL. */ - function walkBetweenExpression($betweenExpr); + public function walkBetweenExpression($betweenExpr); /** * Walks down a LikeExpression AST node, thereby generating the appropriate SQL. @@ -368,7 +370,7 @@ function walkBetweenExpression($betweenExpr); * * @return string The SQL. */ - function walkLikeExpression($likeExpr); + public function walkLikeExpression($likeExpr); /** * Walks down a StateFieldPathExpression AST node, thereby generating the appropriate SQL. @@ -377,7 +379,7 @@ function walkLikeExpression($likeExpr); * * @return string The SQL. */ - function walkStateFieldPathExpression($stateFieldPathExpression); + public function walkStateFieldPathExpression($stateFieldPathExpression); /** * Walks down a ComparisonExpression AST node, thereby generating the appropriate SQL. @@ -386,7 +388,7 @@ function walkStateFieldPathExpression($stateFieldPathExpression); * * @return string The SQL. */ - function walkComparisonExpression($compExpr); + public function walkComparisonExpression($compExpr); /** * Walks down an InputParameter AST node, thereby generating the appropriate SQL. @@ -395,7 +397,7 @@ function walkComparisonExpression($compExpr); * * @return string The SQL. */ - function walkInputParameter($inputParam); + public function walkInputParameter($inputParam); /** * Walks down an ArithmeticExpression AST node, thereby generating the appropriate SQL. @@ -404,7 +406,7 @@ function walkInputParameter($inputParam); * * @return string The SQL. */ - function walkArithmeticExpression($arithmeticExpr); + public function walkArithmeticExpression($arithmeticExpr); /** * Walks down an ArithmeticTerm AST node, thereby generating the appropriate SQL. @@ -413,7 +415,7 @@ function walkArithmeticExpression($arithmeticExpr); * * @return string The SQL. */ - function walkArithmeticTerm($term); + public function walkArithmeticTerm($term); /** * Walks down a StringPrimary that represents an AST node, thereby generating the appropriate SQL. @@ -422,7 +424,7 @@ function walkArithmeticTerm($term); * * @return string The SQL. */ - function walkStringPrimary($stringPrimary); + public function walkStringPrimary($stringPrimary); /** * Walks down an ArithmeticFactor that represents an AST node, thereby generating the appropriate SQL. @@ -431,7 +433,7 @@ function walkStringPrimary($stringPrimary); * * @return string The SQL. */ - function walkArithmeticFactor($factor); + public function walkArithmeticFactor($factor); /** * Walks down an SimpleArithmeticExpression AST node, thereby generating the appropriate SQL. @@ -440,7 +442,7 @@ function walkArithmeticFactor($factor); * * @return string The SQL. */ - function walkSimpleArithmeticExpression($simpleArithmeticExpr); + public function walkSimpleArithmeticExpression($simpleArithmeticExpr); /** * Walks down a PathExpression AST node, thereby generating the appropriate SQL. @@ -449,7 +451,7 @@ function walkSimpleArithmeticExpression($simpleArithmeticExpr); * * @return string The SQL. */ - function walkPathExpression($pathExpr); + public function walkPathExpression($pathExpr); /** * Walks down a ResultVariable that represents an AST node, thereby generating the appropriate SQL. @@ -458,7 +460,7 @@ function walkPathExpression($pathExpr); * * @return string The SQL. */ - function walkResultVariable($resultVariable); + public function walkResultVariable($resultVariable); /** * Gets an executor that can be used to execute the result of this walker. @@ -467,5 +469,5 @@ function walkResultVariable($resultVariable); * * @return Exec\AbstractSqlExecutor */ - function getExecutor($AST); + public function getExecutor($AST); } diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 4fbe3636f71..7d9486e1ed5 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1255,17 +1255,12 @@ private function executeDeletions($class) /** * Gets the commit order. * - * @param array|null $entityChangeSet - * - * @return array + * @return list */ - private function getCommitOrder(?array $entityChangeSet = null) + private function getCommitOrder(): array { - if ($entityChangeSet === null) { - $entityChangeSet = array_merge($this->entityInsertions, $this->entityUpdates, $this->entityDeletions); - } - - $calc = $this->getCommitOrderCalculator(); + $entityChangeSet = array_merge($this->entityInsertions, $this->entityUpdates, $this->entityDeletions); + $calc = $this->getCommitOrderCalculator(); // See if there are any new classes in the changeset, that are not in the // commit order graph yet (don't have a node). From 5e11afcdf1c54403681a849a0d2d78c4c525d38e Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 14 Feb 2021 09:49:39 +0100 Subject: [PATCH 18/27] Housekeeping: CS fixes Doctrine\ORM\Mapping\MappingException --- lib/Doctrine/ORM/Mapping/MappingException.php | 179 +++++++++++++----- 1 file changed, 128 insertions(+), 51 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index d3695593270..e12d30d384f 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -74,7 +74,7 @@ public static function identifierRequired($entityName) */ public static function invalidInheritanceType($entityName, $type) { - return new self("The inheritance type '$type' specified for '$entityName' does not exist."); + return new self(sprintf("The inheritance type '%s' specified for '%s' does not exist.", $type, $entityName)); } /** @@ -92,7 +92,10 @@ public static function generatorNotAllowedWithCompositeId() */ public static function missingFieldName($entity) { - return new self("The field or association mapping misses the 'fieldName' attribute in entity '$entity'."); + return new self(sprintf( + "The field or association mapping misses the 'fieldName' attribute in entity '%s'.", + $entity + )); } /** @@ -102,7 +105,7 @@ public static function missingFieldName($entity) */ public static function missingTargetEntity($fieldName) { - return new self("The association mapping '$fieldName' misses the 'targetEntity' attribute."); + return new self(sprintf("The association mapping '%s' misses the 'targetEntity' attribute.", $fieldName)); } /** @@ -112,7 +115,7 @@ public static function missingTargetEntity($fieldName) */ public static function missingSourceEntity($fieldName) { - return new self("The association mapping '$fieldName' misses the 'sourceEntity' attribute."); + return new self(sprintf("The association mapping '%s' misses the 'sourceEntity' attribute.", $fieldName)); } /** @@ -122,7 +125,7 @@ public static function missingSourceEntity($fieldName) */ public static function missingEmbeddedClass($fieldName) { - return new self("The embed mapping '$fieldName' misses the 'class' attribute."); + return new self(sprintf("The embed mapping '%s' misses the 'class' attribute.", $fieldName)); } /** @@ -133,7 +136,7 @@ public static function missingEmbeddedClass($fieldName) */ public static function mappingFileNotFound($entityName, $fileName) { - return new self("No mapping file found named '$fileName' for class '$entityName'."); + return new self(sprintf("No mapping file found named '%s' for class '%s'.", $fileName, $entityName)); } /** @@ -146,7 +149,7 @@ public static function mappingFileNotFound($entityName, $fileName) */ public static function invalidOverrideFieldName($className, $fieldName) { - return new self("Invalid field override named '$fieldName' for class '$className'."); + return new self(sprintf("Invalid field override named '%s' for class '%s'.", $fieldName, $className)); } /** @@ -159,7 +162,11 @@ public static function invalidOverrideFieldName($className, $fieldName) */ public static function invalidOverrideFieldType($className, $fieldName) { - return new self("The column type of attribute '$fieldName' on class '$className' could not be changed."); + return new self(sprintf( + "The column type of attribute '%s' on class '%s' could not be changed.", + $fieldName, + $className + )); } /** @@ -170,7 +177,7 @@ public static function invalidOverrideFieldType($className, $fieldName) */ public static function mappingNotFound($className, $fieldName) { - return new self("No mapping found for field '$fieldName' on class '$className'."); + return new self(sprintf("No mapping found for field '%s' on class '%s'.", $fieldName, $className)); } /** @@ -181,7 +188,7 @@ public static function mappingNotFound($className, $fieldName) */ public static function queryNotFound($className, $queryName) { - return new self("No query found named '$queryName' on class '$className'."); + return new self(sprintf("No query found named '%s' on class '%s'.", $queryName, $className)); } /** @@ -192,7 +199,7 @@ public static function queryNotFound($className, $queryName) */ public static function resultMappingNotFound($className, $resultName) { - return new self("No result set mapping found named '$resultName' on class '$className'."); + return new self(sprintf("No result set mapping found named '%s' on class '%s'.", $resultName, $className)); } /** @@ -203,7 +210,7 @@ public static function resultMappingNotFound($className, $resultName) */ public static function emptyQueryMapping($entity, $queryName) { - return new self('Query named "' . $queryName . '" in "' . $entity . '" could not be empty.'); + return new self(sprintf('Query named "%s" in "%s" could not be empty.', $queryName, $entity)); } /** @@ -213,7 +220,7 @@ public static function emptyQueryMapping($entity, $queryName) */ public static function nameIsMandatoryForQueryMapping($className) { - return new self("Query name on entity class '$className' is not defined."); + return new self(sprintf("Query name on entity class '%s' is not defined.", $className)); } /** @@ -224,7 +231,11 @@ public static function nameIsMandatoryForQueryMapping($className) */ public static function missingQueryMapping($entity, $queryName) { - return new self('Query named "' . $queryName . '" in "' . $entity . ' requires a result class or result set mapping.'); + return new self(sprintf( + 'Query named "%s" in "%s requires a result class or result set mapping.', + $queryName, + $entity + )); } /** @@ -235,7 +246,11 @@ public static function missingQueryMapping($entity, $queryName) */ public static function missingResultSetMappingEntity($entity, $resultName) { - return new self('Result set mapping named "' . $resultName . '" in "' . $entity . ' requires a entity class name.'); + return new self(sprintf( + 'Result set mapping named "%s" in "%s requires a entity class name.', + $resultName, + $entity + )); } /** @@ -246,7 +261,11 @@ public static function missingResultSetMappingEntity($entity, $resultName) */ public static function missingResultSetMappingFieldName($entity, $resultName) { - return new self('Result set mapping named "' . $resultName . '" in "' . $entity . ' requires a field name.'); + return new self(sprintf( + 'Result set mapping named "%s" in "%s requires a field name.', + $resultName, + $entity + )); } /** @@ -256,7 +275,7 @@ public static function missingResultSetMappingFieldName($entity, $resultName) */ public static function nameIsMandatoryForSqlResultSetMapping($className) { - return new self("Result set mapping name on entity class '$className' is not defined."); + return new self(sprintf("Result set mapping name on entity class '%s' is not defined.", $className)); } /** @@ -266,7 +285,7 @@ public static function nameIsMandatoryForSqlResultSetMapping($className) */ public static function oneToManyRequiresMappedBy($fieldName) { - return new self("OneToMany mapping on field '$fieldName' requires the 'mappedBy' attribute."); + return new self(sprintf("OneToMany mapping on field '%s' requires the 'mappedBy' attribute.", $fieldName)); } /** @@ -276,7 +295,7 @@ public static function oneToManyRequiresMappedBy($fieldName) */ public static function joinTableRequired($fieldName) { - return new self("The mapping of field '$fieldName' requires an the 'joinTable' attribute."); + return new self(sprintf("The mapping of field '%s' requires an the 'joinTable' attribute.", $fieldName)); } /** @@ -289,9 +308,9 @@ public static function joinTableRequired($fieldName) * * @return MappingException */ - static function missingRequiredOption($field, $expectedOption, $hint = '') + public static function missingRequiredOption($field, $expectedOption, $hint = '') { - $message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required."; + $message = "The mapping of field '" . $field . "' is invalid: The option '" . $expectedOption . "' is required."; if (! empty($hint)) { $message .= ' (Hint: ' . $hint . ')'; @@ -309,7 +328,7 @@ static function missingRequiredOption($field, $expectedOption, $hint = '') */ public static function invalidMapping($fieldName) { - return new self("The mapping of field '$fieldName' is invalid."); + return new self(sprintf("The mapping of field '%s' is invalid.", $fieldName)); } /** @@ -323,7 +342,7 @@ public static function invalidMapping($fieldName) */ public static function reflectionFailure($entity, ReflectionException $previousException) { - return new self('An error occurred in ' . $entity, 0, $previousException); + return new self(sprintf('An error occurred in %s', $entity), 0, $previousException); } /** @@ -334,8 +353,11 @@ public static function reflectionFailure($entity, ReflectionException $previousE */ public static function joinColumnMustPointToMappedField($className, $joinColumn) { - return new self('The column ' . $joinColumn . ' must be mapped to a field in class ' - . $className . ' since it is referenced by a join column of another class.'); + return new self(sprintf( + 'The column %s must be mapped to a field in class %s since it is referenced by a join column of another class.', + $joinColumn, + $className + )); } /** @@ -368,7 +390,11 @@ public static function classIsNotAValidEntityOrMappedSuperClass($className) */ public static function propertyTypeIsRequired($className, $propertyName) { - return new self("The attribute 'type' is required for the column description of property " . $className . '::$' . $propertyName . '.'); + return new self(sprintf( + "The attribute 'type' is required for the column description of property %s::\$%s.", + $className, + $propertyName + )); } /** @@ -378,7 +404,7 @@ public static function propertyTypeIsRequired($className, $propertyName) */ public static function tableIdGeneratorNotImplemented($className) { - return new self('TableIdGenerator is not yet implemented for use with class ' . $className); + return new self(sprintf('TableIdGenerator is not yet implemented for use with class %s', $className)); } /** @@ -389,7 +415,11 @@ public static function tableIdGeneratorNotImplemented($className) */ public static function duplicateFieldMapping($entity, $fieldName) { - return new self('Property "' . $fieldName . '" in "' . $entity . '" was already declared, but it must be declared only once'); + return new self(sprintf( + 'Property "%s" in "%s" was already declared, but it must be declared only once', + $fieldName, + $entity + )); } /** @@ -400,7 +430,11 @@ public static function duplicateFieldMapping($entity, $fieldName) */ public static function duplicateAssociationMapping($entity, $fieldName) { - return new self('Property "' . $fieldName . '" in "' . $entity . '" was already declared, but it must be declared only once'); + return new self(sprintf( + 'Property "%s" in "%s" was already declared, but it must be declared only once', + $fieldName, + $entity + )); } /** @@ -411,7 +445,11 @@ public static function duplicateAssociationMapping($entity, $fieldName) */ public static function duplicateQueryMapping($entity, $queryName) { - return new self('Query named "' . $queryName . '" in "' . $entity . '" was already declared, but it must be declared only once'); + return new self(sprintf( + 'Query named "%s" in "%s" was already declared, but it must be declared only once', + $queryName, + $entity + )); } /** @@ -422,7 +460,11 @@ public static function duplicateQueryMapping($entity, $queryName) */ public static function duplicateResultSetMapping($entity, $resultName) { - return new self('Result set mapping named "' . $resultName . '" in "' . $entity . '" was already declared, but it must be declared only once'); + return new self(sprintf( + 'Result set mapping named "%s" in "%s" was already declared, but it must be declared only once', + $resultName, + $entity + )); } /** @@ -454,8 +496,12 @@ public static function noIdDefined($entity) */ public static function unsupportedOptimisticLockingType($entity, $fieldName, $unsupportedType) { - return new self('Locking type "' . $unsupportedType . '" (specified in "' . $entity . '", field "' . $fieldName . '") ' - . 'is not supported by Doctrine.'); + return new self(sprintf( + 'Locking type "%s" (specified in "%s", field "%s") is not supported by Doctrine.', + $unsupportedType, + $entity, + $fieldName + )); } /** @@ -495,9 +541,9 @@ public static function invalidClassInDiscriminatorMap($className, $owningClass) } /** - * @param string $className - * @param array $entries - * @param array $map + * @param string $className + * @param string[] $entries + * @param array $map * * @return MappingException */ @@ -523,7 +569,10 @@ static function ($a, $b) { */ public static function missingDiscriminatorMap($className) { - return new self("Entity class '$className' is using inheritance but no discriminator map was defined."); + return new self(sprintf( + "Entity class '%s' is using inheritance but no discriminator map was defined.", + $className + )); } /** @@ -533,7 +582,10 @@ public static function missingDiscriminatorMap($className) */ public static function missingDiscriminatorColumn($className) { - return new self("Entity class '$className' is using inheritance but no discriminator column was defined."); + return new self(sprintf( + "Entity class '%s' is using inheritance but no discriminator column was defined.", + $className + )); } /** @@ -544,7 +596,11 @@ public static function missingDiscriminatorColumn($className) */ public static function invalidDiscriminatorColumnType($className, $type) { - return new self("Discriminator column type on entity class '$className' is not allowed to be '$type'. 'string' or 'integer' type variables are suggested!"); + return new self(sprintf( + "Discriminator column type on entity class '%s' is not allowed to be '%s'. 'string' or 'integer' type variables are suggested!", + $className, + $type + )); } /** @@ -554,7 +610,7 @@ public static function invalidDiscriminatorColumnType($className, $type) */ public static function nameIsMandatoryForDiscriminatorColumns($className) { - return new self("Discriminator column name on entity class '$className' is not defined."); + return new self(sprintf("Discriminator column name on entity class '%s' is not defined.", $className)); } /** @@ -565,7 +621,11 @@ public static function nameIsMandatoryForDiscriminatorColumns($className) */ public static function cannotVersionIdField($className, $fieldName) { - return new self("Setting Id field '$fieldName' as versionable in entity class '$className' is not supported."); + return new self(sprintf( + "Setting Id field '%s' as versionable in entity class '%s' is not supported.", + $fieldName, + $className + )); } /** @@ -577,7 +637,13 @@ public static function cannotVersionIdField($className, $fieldName) */ public static function sqlConversionNotAllowedForIdentifiers($className, $fieldName, $type) { - return new self("It is not possible to set id field '$fieldName' to type '$type' in entity class '$className'. The type '$type' requires conversion SQL which is not allowed for identifiers."); + return new self(sprintf( + "It is not possible to set id field '%s' to type '%s' in entity class '%s'. The type '%s' requires conversion SQL which is not allowed for identifiers.", + $fieldName, + $type, + $className, + $type + )); } /** @@ -623,7 +689,7 @@ public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($classNam */ public static function noSingleAssociationJoinColumnFound($className, $field) { - return new self("'$className#$field' is not an association with a single join column."); + return new self(sprintf("'%s#%s' is not an association with a single join column.", $className, $field)); } /** @@ -650,8 +716,11 @@ public static function noFieldNameFoundForColumn($className, $column) */ public static function illegalOrphanRemovalOnIdentifierAssociation($className, $field) { - return new self('The orphan removal option is not allowed on an association that is ' . - "part of the identifier in '$className#$field'."); + return new self(sprintf( + "The orphan removal option is not allowed on an association that is part of the identifier in '%s#%s'.", + $className, + $field + )); } /** @@ -674,7 +743,11 @@ public static function illegalOrphanRemoval($className, $field) */ public static function illegalInverseIdentifierAssociation($className, $field) { - return new self("An inverse association is not allowed to be identifier in '$className#$field'."); + return new self(sprintf( + "An inverse association is not allowed to be identifier in '%s#%s'.", + $className, + $field + )); } /** @@ -685,7 +758,11 @@ public static function illegalInverseIdentifierAssociation($className, $field) */ public static function illegalToManyIdentifierAssociation($className, $field) { - return new self("Many-to-many or one-to-many associations are not allowed to be identifier in '$className#$field'."); + return new self(sprintf( + "Many-to-many or one-to-many associations are not allowed to be identifier in '%s#%s'.", + $className, + $field + )); } /** @@ -793,9 +870,9 @@ public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $a } /** - * @param array $cascades - * @param string $className - * @param string $propertyName + * @param string[] $cascades + * @param string $className + * @param string $propertyName * * @return MappingException */ @@ -843,7 +920,7 @@ public static function infiniteEmbeddableNesting($className, $propertyName) ); } - public static function illegalOverrideOfInheritedProperty($className, $propertyName) + public static function illegalOverrideOfInheritedProperty($className, $propertyName): MappingException { return new self( sprintf( From 8f62bd39b5f08b814f429ccfb3badccf32f68b40 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 14 Feb 2021 09:53:19 +0100 Subject: [PATCH 19/27] Housekeeping: CS fixes Doctrine\ORM\ORMException --- lib/Doctrine/ORM/ORMException.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ORM/ORMException.php b/lib/Doctrine/ORM/ORMException.php index 9ba4e6753bf..7d7b6d5fd00 100644 --- a/lib/Doctrine/ORM/ORMException.php +++ b/lib/Doctrine/ORM/ORMException.php @@ -100,7 +100,7 @@ public static function entityMissingAssignedIdForField($entity, $field) */ public static function unrecognizedField($field) { - return new self("Unrecognized field: $field"); + return new self(sprintf('Unrecognized field: %s', $field)); } /** @@ -134,7 +134,7 @@ public static function invalidOrientation($className, $field) */ public static function invalidFlushMode($mode) { - return new self("'$mode' is an invalid flush mode."); + return new self(sprintf("'%s' is an invalid flush mode.", $mode)); } /** @@ -152,7 +152,7 @@ public static function entityManagerClosed() */ public static function invalidHydrationMode($mode) { - return new self("'$mode' is an invalid hydration mode."); + return new self(sprintf("'%s' is an invalid hydration mode.", $mode)); } /** @@ -281,7 +281,7 @@ public static function proxyClassesAlwaysRegenerating() public static function unknownEntityNamespace($entityNamespaceAlias) { return new self( - "Unknown Entity namespace alias '$entityNamespaceAlias'." + sprintf("Unknown Entity namespace alias '%s'.", $entityNamespaceAlias) ); } @@ -307,7 +307,7 @@ public static function invalidEntityRepository($className) */ public static function missingIdentifierField($className, $fieldName) { - return new self("The identifier $fieldName is missing for a query of " . $className); + return new self(sprintf('The identifier %s is missing for a query of %s', $fieldName, $className)); } /** From e45d212f0215e6b1d9739fbbafb1dfcdea474eea Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 14 Feb 2021 14:28:42 +0100 Subject: [PATCH 20/27] Housekeeping: CS fixes Doctrine\ORM\Mapping\MappingException --- lib/Doctrine/ORM/Mapping/MappingException.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/MappingException.php b/lib/Doctrine/ORM/Mapping/MappingException.php index e12d30d384f..9599ff0ae36 100644 --- a/lib/Doctrine/ORM/Mapping/MappingException.php +++ b/lib/Doctrine/ORM/Mapping/MappingException.php @@ -920,7 +920,10 @@ public static function infiniteEmbeddableNesting($className, $propertyName) ); } - public static function illegalOverrideOfInheritedProperty($className, $propertyName): MappingException + /** + * @return MappingException + */ + public static function illegalOverrideOfInheritedProperty($className, $propertyName) { return new self( sprintf( From c29370e061b2b5ef8d376c508724c762a719c145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 14 Feb 2021 09:03:05 +0100 Subject: [PATCH 21/27] Automatically fix cs --- tests/Doctrine/Tests/Models/CMS/CmsEmail.php | 5 +- tests/Doctrine/Tests/Models/CMS/CmsTag.php | 8 ++- tests/Doctrine/Tests/Models/Cache/City.php | 6 ++- tests/Doctrine/Tests/Models/Cache/Person.php | 5 +- tests/Doctrine/Tests/Models/Cache/Token.php | 5 +- .../Tests/Models/Company/CompanyCar.php | 1 + .../Tests/Models/Company/CompanyEmployee.php | 12 ++++- .../Tests/Models/Company/CompanyManager.php | 7 ++- .../Models/CustomType/CustomTypeChild.php | 1 + .../Models/CustomType/CustomTypeParent.php | 7 ++- .../Models/CustomType/CustomTypeUpperCase.php | 1 + .../Tests/Models/DDC2372/DDC2372Address.php | 6 ++- .../Tests/Models/DDC2372/DDC2372User.php | 1 + .../Tests/Models/DDC3699/DDC3699Child.php | 5 +- .../Models/DDC3699/DDC3699RelationOne.php | 5 +- .../Models/ECommerce/ECommerceCategory.php | 7 ++- .../Models/ECommerce/ECommerceCustomer.php | 5 +- .../Models/ECommerce/ECommerceShipping.php | 6 ++- .../Tests/Models/Forum/ForumBoard.php | 5 +- .../Tests/Models/Forum/ForumCategory.php | 5 +- .../Tests/Models/Generic/BooleanModel.php | 1 + .../Tests/Models/Generic/DateTimeModel.php | 1 + .../Tests/Models/Generic/DecimalModel.php | 1 + .../Models/Generic/SerializationModel.php | 1 + .../EntityWithArrayDefaultArrayValueM2M.php | 7 ++- .../Tests/Models/Legacy/LegacyCar.php | 8 ++- .../Tests/Models/Pagination/Company.php | 6 ++- .../Tests/Models/Pagination/Department.php | 1 + .../Doctrine/Tests/Models/Pagination/Logo.php | 10 +++- .../Doctrine/Tests/Models/Pagination/User.php | 1 + tests/Doctrine/Tests/Models/Quote/Group.php | 7 ++- .../InversedManyToManyCompositeIdEntity.php | 6 ++- ...dManyToManyCompositeIdForeignKeyEntity.php | 6 ++- .../InversedManyToManyEntity.php | 6 ++- .../InversedOneToOneCompositeIdEntity.php | 5 +- ...sedOneToOneCompositeIdForeignKeyEntity.php | 5 +- .../InversedOneToOneEntity.php | 5 +- .../ORM/Functional/CascadeRemoveOrderTest.php | 2 + .../Functional/ClassTableInheritanceTest2.php | 12 ++++- .../ORM/Functional/DefaultValuesTest.php | 6 ++- .../ORM/Functional/Locking/OptimisticTest.php | 3 ++ .../Tests/ORM/Functional/NotifyPolicyTest.php | 11 +++- .../Tests/ORM/Functional/ReadOnlyTest.php | 5 +- .../ORM/Functional/Ticket/DDC1113Test.php | 5 +- .../ORM/Functional/Ticket/DDC1151Test.php | 6 ++- .../ORM/Functional/Ticket/DDC1193Test.php | 13 ++++- .../ORM/Functional/Ticket/DDC1335Test.php | 1 + .../ORM/Functional/Ticket/DDC1458Test.php | 15 ++++-- .../ORM/Functional/Ticket/DDC1461Test.php | 5 +- .../ORM/Functional/Ticket/DDC1514Test.php | 6 ++- .../ORM/Functional/Ticket/DDC1515Test.php | 10 +++- .../ORM/Functional/Ticket/DDC1548Test.php | 10 +++- .../ORM/Functional/Ticket/DDC1690Test.php | 10 +++- .../ORM/Functional/Ticket/DDC1757Test.php | 10 +++- .../ORM/Functional/Ticket/DDC1998Test.php | 5 +- .../ORM/Functional/Ticket/DDC199Test.php | 1 + .../ORM/Functional/Ticket/DDC211Test.php | 6 ++- .../ORM/Functional/Ticket/DDC2230Test.php | 5 +- .../ORM/Functional/Ticket/DDC2575Test.php | 10 +++- .../ORM/Functional/Ticket/DDC2579Test.php | 5 +- .../ORM/Functional/Ticket/DDC258Test.php | 1 + .../ORM/Functional/Ticket/DDC2759Test.php | 10 +++- .../ORM/Functional/Ticket/DDC2775Test.php | 3 ++ .../ORM/Functional/Ticket/DDC2931Test.php | 15 ++++-- .../ORM/Functional/Ticket/DDC2996Test.php | 5 +- .../ORM/Functional/Ticket/DDC3042Test.php | 50 +++++++++++++++---- .../ORM/Functional/Ticket/DDC3330Test.php | 2 + .../ORM/Functional/Ticket/DDC3785Test.php | 1 + .../ORM/Functional/Ticket/DDC425Test.php | 1 + .../ORM/Functional/Ticket/DDC444Test.php | 1 + .../ORM/Functional/Ticket/DDC522Test.php | 10 +++- .../ORM/Functional/Ticket/DDC633Test.php | 10 +++- .../ORM/Functional/Ticket/DDC698Test.php | 6 ++- .../ORM/Functional/Ticket/DDC719Test.php | 6 ++- .../ORM/Functional/Ticket/DDC729Test.php | 11 +++- .../ORM/Functional/Ticket/DDC832Test.php | 10 +++- .../ORM/Functional/Ticket/DDC837Test.php | 10 +++- 77 files changed, 408 insertions(+), 86 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsEmail.php b/tests/Doctrine/Tests/Models/CMS/CmsEmail.php index bc82035a6ce..6982639a4cf 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsEmail.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsEmail.php @@ -21,7 +21,10 @@ class CmsEmail /** @Column(length=250) */ public $email; - /** @OneToOne(targetEntity="CmsUser", mappedBy="email") */ + /** + * @var CmsUser + * @OneToOne(targetEntity="CmsUser", mappedBy="email") + */ public $user; public function getId() diff --git a/tests/Doctrine/Tests/Models/CMS/CmsTag.php b/tests/Doctrine/Tests/Models/CMS/CmsTag.php index b436d0aa23e..9c26b0205c6 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsTag.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsTag.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\Models\CMS; +use Doctrine\Common\Collections\Collection; + /** * Description of CmsTag * @@ -21,7 +23,11 @@ class CmsTag public $id; /** @Column(length=50, name="tag_name", nullable=true) */ public $name; - /** @ManyToMany(targetEntity="CmsUser", mappedBy="tags") */ + + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="CmsUser", mappedBy="tags") + */ public $users; public function setName($name): void diff --git a/tests/Doctrine/Tests/Models/Cache/City.php b/tests/Doctrine/Tests/Models/Cache/City.php index c667f4b6b9b..b789c85d5ea 100644 --- a/tests/Doctrine/Tests/Models/Cache/City.php +++ b/tests/Doctrine/Tests/Models/Cache/City.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\Cache; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping\ClassMetadataInfo; /** @@ -32,7 +33,10 @@ class City */ protected $state; - /** @ManyToMany(targetEntity="Travel", mappedBy="visitedCities") */ + /** + * @var Collection + * @ManyToMany(targetEntity="Travel", mappedBy="visitedCities") + */ public $travels; /** diff --git a/tests/Doctrine/Tests/Models/Cache/Person.php b/tests/Doctrine/Tests/Models/Cache/Person.php index 016c8d986b4..f7452d231c0 100644 --- a/tests/Doctrine/Tests/Models/Cache/Person.php +++ b/tests/Doctrine/Tests/Models/Cache/Person.php @@ -22,7 +22,10 @@ class Person /** @Column(unique=true) */ public $name; - /** @OneToOne(targetEntity="Address", mappedBy="person") */ + /** + * @var Address + * @OneToOne(targetEntity="Address", mappedBy="person") + */ public $address; public function __construct($name) diff --git a/tests/Doctrine/Tests/Models/Cache/Token.php b/tests/Doctrine/Tests/Models/Cache/Token.php index d2511ecfd39..1f05b4e1c37 100644 --- a/tests/Doctrine/Tests/Models/Cache/Token.php +++ b/tests/Doctrine/Tests/Models/Cache/Token.php @@ -26,7 +26,10 @@ class Token /** @Column(type="date") */ public $expiresAt; - /** @OneToOne(targetEntity="Client") */ + /** + * @var Client + * @OneToOne(targetEntity="Client") + */ public $client; /** diff --git a/tests/Doctrine/Tests/Models/Company/CompanyCar.php b/tests/Doctrine/Tests/Models/Company/CompanyCar.php index d8032329130..8faffb49f04 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyCar.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyCar.php @@ -11,6 +11,7 @@ class CompanyCar { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php index f2fd355f38e..2f0f8f0966a 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyEmployee.php @@ -4,13 +4,18 @@ namespace Doctrine\Tests\Models\Company; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @Table(name="company_employees") */ class CompanyEmployee extends CompanyPerson { - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ private $salary; /** @@ -22,7 +27,10 @@ class CompanyEmployee extends CompanyPerson /** @Column(type="datetime", nullable=true) */ private $startDate; - /** @ManyToMany(targetEntity="CompanyContract", mappedBy="engineers", fetch="EXTRA_LAZY") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="CompanyContract", mappedBy="engineers", fetch="EXTRA_LAZY") + */ public $contracts; /** @OneToMany(targetEntity="CompanyFlexUltraContract", mappedBy="salesPerson", fetch="EXTRA_LAZY") */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyManager.php b/tests/Doctrine/Tests/Models/Company/CompanyManager.php index 5359378c477..341d726f0fa 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyManager.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyManager.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\Models\Company; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @Table(name="company_managers") @@ -22,7 +24,10 @@ class CompanyManager extends CompanyEmployee */ private $car; - /** @ManyToMany(targetEntity="CompanyFlexContract", mappedBy="managers", fetch="EXTRA_LAZY") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="CompanyFlexContract", mappedBy="managers", fetch="EXTRA_LAZY") + */ public $managedContracts; public function getTitle() diff --git a/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php b/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php index cdb61a00469..1613927e749 100644 --- a/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php +++ b/tests/Doctrine/Tests/Models/CustomType/CustomTypeChild.php @@ -11,6 +11,7 @@ class CustomTypeChild { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php b/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php index 9655c2c3407..45d723590da 100644 --- a/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php +++ b/tests/Doctrine/Tests/Models/CustomType/CustomTypeParent.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\CustomType; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; /** * @Entity @@ -13,6 +14,7 @@ class CustomTypeParent { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -24,7 +26,10 @@ class CustomTypeParent /** @OneToOne(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeChild", cascade={"persist", "remove"}) */ public $child; - /** @ManyToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeParent", mappedBy="myFriends") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="Doctrine\Tests\Models\CustomType\CustomTypeParent", mappedBy="myFriends") + */ private $friendsWithMe; /** diff --git a/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php b/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php index 2c1fd1e1cbb..bc91077e1d6 100644 --- a/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php +++ b/tests/Doctrine/Tests/Models/CustomType/CustomTypeUpperCase.php @@ -11,6 +11,7 @@ class CustomTypeUpperCase { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php b/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php index 2c9c9e2b863..7035171cecf 100644 --- a/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php +++ b/tests/Doctrine/Tests/Models/DDC2372/DDC2372Address.php @@ -8,6 +8,7 @@ class DDC2372Address { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -17,7 +18,10 @@ class DDC2372Address * @Column(type="string", length=255) */ private $street; - /** @OneToOne(targetEntity="User", mappedBy="address") */ + /** + * @var User + * @OneToOne(targetEntity="User", mappedBy="address") + */ private $user; public function getId() diff --git a/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php b/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php index 7e625a5f327..6d2e9b23b60 100644 --- a/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php +++ b/tests/Doctrine/Tests/Models/DDC2372/DDC2372User.php @@ -12,6 +12,7 @@ class DDC2372User use DDC2372AddressTrait; /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php index ab787a8eed5..cb574a1a626 100644 --- a/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php +++ b/tests/Doctrine/Tests/Models/DDC3699/DDC3699Child.php @@ -16,7 +16,10 @@ class DDC3699Child extends DDC3699Parent */ public $childField; - /** @OneToOne(targetEntity="DDC3699RelationOne", inversedBy="child") */ + /** + * @var DDC3699RelationOne + * @OneToOne(targetEntity="DDC3699RelationOne", inversedBy="child") + */ public $oneRelation; /** @OneToMany(targetEntity="DDC3699RelationMany", mappedBy="child") */ diff --git a/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationOne.php b/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationOne.php index 78a04e1aac0..d7e22c01bbc 100644 --- a/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationOne.php +++ b/tests/Doctrine/Tests/Models/DDC3699/DDC3699RelationOne.php @@ -13,6 +13,9 @@ class DDC3699RelationOne /** @Id @Column(type="integer") */ public $id; - /** @OneToOne(targetEntity="DDC3699Child", mappedBy="oneRelation") */ + /** + * @var DDC3699Child + * @OneToOne(targetEntity="DDC3699Child", mappedBy="oneRelation") + */ public $child; } diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php index 0dd612b4b00..32e332f7ce3 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\ECommerce; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; /** * ECommerceCategory @@ -16,6 +17,7 @@ class ECommerceCategory { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -27,7 +29,10 @@ class ECommerceCategory */ private $name; - /** @ManyToMany(targetEntity="ECommerceProduct", mappedBy="categories") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="ECommerceProduct", mappedBy="categories") + */ private $products; /** @OneToMany(targetEntity="ECommerceCategory", mappedBy="parent", cascade={"persist"}) */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php index 807bb72a491..f63a7fb5840 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php @@ -26,7 +26,10 @@ class ECommerceCustomer */ private $name; - /** @OneToOne(targetEntity="ECommerceCart", mappedBy="customer", cascade={"persist"}) */ + /** + * @var ECommerceCart + * @OneToOne(targetEntity="ECommerceCart", mappedBy="customer", cascade={"persist"}) + */ private $cart; /** diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php index fdf9505ae53..97e6a1f5445 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceShipping.php @@ -14,12 +14,16 @@ class ECommerceShipping { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ private $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ private $days; public function getId() diff --git a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php index 4bcd572f08a..eda1715036c 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php @@ -18,7 +18,10 @@ class ForumBoard * @Column(type="integer") */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $position; /** * @ManyToOne(targetEntity="ForumCategory", inversedBy="boards") diff --git a/tests/Doctrine/Tests/Models/Forum/ForumCategory.php b/tests/Doctrine/Tests/Models/Forum/ForumCategory.php index 7875b73a2b8..f0f6d254c80 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumCategory.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumCategory.php @@ -15,7 +15,10 @@ class ForumCategory * @Id */ private $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $position; /** * @var string diff --git a/tests/Doctrine/Tests/Models/Generic/BooleanModel.php b/tests/Doctrine/Tests/Models/Generic/BooleanModel.php index 9cc2de67e89..4d97ec7873d 100644 --- a/tests/Doctrine/Tests/Models/Generic/BooleanModel.php +++ b/tests/Doctrine/Tests/Models/Generic/BooleanModel.php @@ -11,6 +11,7 @@ class BooleanModel { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php b/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php index 70bc977403e..ac27fd3c6d9 100644 --- a/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php +++ b/tests/Doctrine/Tests/Models/Generic/DateTimeModel.php @@ -11,6 +11,7 @@ class DateTimeModel { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/Models/Generic/DecimalModel.php b/tests/Doctrine/Tests/Models/Generic/DecimalModel.php index 078f0df2bf7..d92241ac31e 100644 --- a/tests/Doctrine/Tests/Models/Generic/DecimalModel.php +++ b/tests/Doctrine/Tests/Models/Generic/DecimalModel.php @@ -11,6 +11,7 @@ class DecimalModel { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/Generic/SerializationModel.php b/tests/Doctrine/Tests/Models/Generic/SerializationModel.php index 0422171a525..2dc5f224a3b 100644 --- a/tests/Doctrine/Tests/Models/Generic/SerializationModel.php +++ b/tests/Doctrine/Tests/Models/Generic/SerializationModel.php @@ -11,6 +11,7 @@ class SerializationModel { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/Models/Hydration/EntityWithArrayDefaultArrayValueM2M.php b/tests/Doctrine/Tests/Models/Hydration/EntityWithArrayDefaultArrayValueM2M.php index 0112ddc3dbf..3493893ab1b 100644 --- a/tests/Doctrine/Tests/Models/Hydration/EntityWithArrayDefaultArrayValueM2M.php +++ b/tests/Doctrine/Tests/Models/Hydration/EntityWithArrayDefaultArrayValueM2M.php @@ -4,12 +4,17 @@ namespace Doctrine\Tests\Models\Hydration; +use Doctrine\Common\Collections\Collection; + /** @Entity */ class EntityWithArrayDefaultArrayValueM2M { /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ public $id; - /** @ManyToMany(targetEntity=SimpleEntity::class) */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity=SimpleEntity::class) + */ public $collection = []; } diff --git a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php index d7ff99c4e94..571b77a6aae 100644 --- a/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php +++ b/tests/Doctrine/Tests/Models/Legacy/LegacyCar.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\Models\Legacy; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @Table(name="legacy_cars") @@ -17,7 +19,11 @@ class LegacyCar * @Column(name="iCarId", type="integer", nullable=false) */ public $_id; - /** @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars") */ + + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="LegacyUser", mappedBy="_cars") + */ public $_users; /** diff --git a/tests/Doctrine/Tests/Models/Pagination/Company.php b/tests/Doctrine/Tests/Models/Pagination/Company.php index 39fd66b5a66..11d9c831741 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Company.php +++ b/tests/Doctrine/Tests/Models/Pagination/Company.php @@ -13,6 +13,7 @@ class Company { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ @@ -30,7 +31,10 @@ class Company */ public $jurisdiction; - /** @OneToOne(targetEntity="Logo", mappedBy="company", cascade={"persist"}, orphanRemoval=true) */ + /** + * @var Logo + * @OneToOne(targetEntity="Logo", mappedBy="company", cascade={"persist"}, orphanRemoval=true) + */ public $logo; /** @OneToMany(targetEntity="Department", mappedBy="company", cascade={"persist"}, orphanRemoval=true) */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Department.php b/tests/Doctrine/Tests/Models/Pagination/Department.php index 5033a167a5c..207289389e6 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Department.php +++ b/tests/Doctrine/Tests/Models/Pagination/Department.php @@ -13,6 +13,7 @@ class Department { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/Models/Pagination/Logo.php b/tests/Doctrine/Tests/Models/Pagination/Logo.php index 74a54dc526a..2a2748074dd 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Logo.php +++ b/tests/Doctrine/Tests/Models/Pagination/Logo.php @@ -25,10 +25,16 @@ class Logo */ public $image; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $image_height; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $image_width; /** diff --git a/tests/Doctrine/Tests/Models/Pagination/User.php b/tests/Doctrine/Tests/Models/Pagination/User.php index afb0b61df69..68bcb6a7c53 100644 --- a/tests/Doctrine/Tests/Models/Pagination/User.php +++ b/tests/Doctrine/Tests/Models/Pagination/User.php @@ -14,6 +14,7 @@ abstract class User { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/Models/Quote/Group.php b/tests/Doctrine/Tests/Models/Quote/Group.php index 0e43302654b..8d9005a0672 100644 --- a/tests/Doctrine/Tests/Models/Quote/Group.php +++ b/tests/Doctrine/Tests/Models/Quote/Group.php @@ -4,6 +4,8 @@ namespace Doctrine\Tests\Models\Quote; +use Doctrine\Common\Collections\Collection; + /** * @Entity * @Table(name="`quote-group`") @@ -28,7 +30,10 @@ class Group */ public $parent; - /** @ManyToMany(targetEntity="User", mappedBy="groups") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="User", mappedBy="groups") + */ public $users; public function __construct($name = null, ?Group $parent = null) diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdEntity.php index 92e60b2cef3..a954abcde4e 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdEntity.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\ValueConversionType; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; /** * @Entity @@ -24,7 +25,10 @@ class InversedManyToManyCompositeIdEntity */ public $id2; - /** @ManyToMany(targetEntity="OwningManyToManyCompositeIdEntity", mappedBy="associatedEntities") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="OwningManyToManyCompositeIdEntity", mappedBy="associatedEntities") + */ public $associatedEntities; public function __construct() diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdForeignKeyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdForeignKeyEntity.php index a3b2d87800b..25da7f15e4f 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdForeignKeyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyCompositeIdForeignKeyEntity.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\ValueConversionType; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; /** * @Entity @@ -25,7 +26,10 @@ class InversedManyToManyCompositeIdForeignKeyEntity */ public $foreignEntity; - /** @ManyToMany(targetEntity="OwningManyToManyCompositeIdForeignKeyEntity", mappedBy="associatedEntities") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="OwningManyToManyCompositeIdForeignKeyEntity", mappedBy="associatedEntities") + */ public $associatedEntities; public function __construct() diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyEntity.php index fac3663b084..0fc8ff46004 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedManyToManyEntity.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\Models\ValueConversionType; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; /** * @Entity @@ -18,7 +19,10 @@ class InversedManyToManyEntity */ public $id1; - /** @ManyToMany(targetEntity="OwningManyToManyEntity", mappedBy="associatedEntities") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="OwningManyToManyEntity", mappedBy="associatedEntities") + */ public $associatedEntities; public function __construct() diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php index 8e075d293f5..c7cbaaffe1d 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdEntity.php @@ -28,6 +28,9 @@ class InversedOneToOneCompositeIdEntity */ public $someProperty; - /** @OneToOne(targetEntity="OwningOneToOneCompositeIdEntity", mappedBy="associatedEntity") */ + /** + * @var OwningOneToOneCompositeIdEntity + * @OneToOne(targetEntity="OwningOneToOneCompositeIdEntity", mappedBy="associatedEntity") + */ public $associatedEntity; } diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php index 03f8885e894..02303ef2bcc 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneCompositeIdForeignKeyEntity.php @@ -29,6 +29,9 @@ class InversedOneToOneCompositeIdForeignKeyEntity */ public $someProperty; - /** @OneToOne(targetEntity="OwningOneToOneCompositeIdForeignKeyEntity", mappedBy="associatedEntity") */ + /** + * @var OwningOneToOneCompositeIdForeignKeyEntity + * @OneToOne(targetEntity="OwningOneToOneCompositeIdForeignKeyEntity", mappedBy="associatedEntity") + */ public $associatedEntity; } diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php index 7b7b5e5ada7..401d08bfc1a 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/InversedOneToOneEntity.php @@ -22,6 +22,9 @@ class InversedOneToOneEntity */ public $someProperty; - /** @OneToOne(targetEntity="OwningOneToOneEntity", mappedBy="associatedEntity") */ + /** + * @var OwningOneToOneEntity + * @OneToOne(targetEntity="OwningOneToOneEntity", mappedBy="associatedEntity") + */ public $associatedEntity; } diff --git a/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php b/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php index 79c444f1bcf..4c275497430 100644 --- a/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/CascadeRemoveOrderTest.php @@ -83,6 +83,7 @@ public function testMany(): void class CascadeRemoveOrderEntityO { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ @@ -140,6 +141,7 @@ public function getOneToManyGs() class CascadeRemoveOrderEntityG { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index f7af8e5362e..764f568d702 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Proxy\Proxy; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -96,7 +97,10 @@ class CTIParent */ private $id; - /** @OneToOne(targetEntity="CTIRelated", mappedBy="ctiParent") */ + /** + * @var CTIRelated + * @OneToOne(targetEntity="CTIRelated", mappedBy="ctiParent") + */ private $related; public function getId() @@ -142,6 +146,7 @@ public function setData($data): void class CTIRelated { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -179,7 +184,10 @@ class CTIRelated2 * @GeneratedValue */ private $id; - /** @ManyToMany(targetEntity="CTIChild") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="CTIChild") + */ private $ctiChildren; public function __construct() diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index e035dc4ea8d..097d7249a5f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -97,6 +97,7 @@ public function testGetPartialReferenceWithDefaultValueNotEvaluatedInFlush(): vo class DefaultValueUser { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -111,7 +112,10 @@ class DefaultValueUser * @Column(type="string") */ public $type = 'Poweruser'; - /** @OneToOne(targetEntity="DefaultValueAddress", mappedBy="user", cascade={"persist"}) */ + /** + * @var DefaultValueAddress + * @OneToOne(targetEntity="DefaultValueAddress", mappedBy="user", cascade={"persist"}) + */ public $address; public function getId() diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php index 4cf5967e7c4..9fb38ffc6f8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/OptimisticTest.php @@ -273,6 +273,7 @@ public function testOptimisticTimestampLockFailureThrowsException(OptimisticTime class OptimisticJoinedParent { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -308,6 +309,7 @@ class OptimisticJoinedChild extends OptimisticJoinedParent class OptimisticStandard { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ @@ -335,6 +337,7 @@ public function getVersion() class OptimisticTimestamp { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php b/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php index 3fb1ae99c20..1a4a9b6247e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NotifyPolicyTest.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Persistence\NotifyPropertyChanged; use Doctrine\Persistence\PropertyChangedListener; use Doctrine\Tests\OrmFunctionalTestCase; @@ -126,7 +127,10 @@ class NotifyUser extends NotifyBaseEntity /** @Column */ private $name; - /** @ManyToMany(targetEntity="NotifyGroup") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="NotifyGroup") + */ private $groups; public function __construct() @@ -170,7 +174,10 @@ class NotifyGroup extends NotifyBaseEntity /** @Column */ private $name; - /** @ManyToMany(targetEntity="NotifyUser", mappedBy="groups") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="NotifyUser", mappedBy="groups") + */ private $users; public function __construct() diff --git a/tests/Doctrine/Tests/ORM/Functional/ReadOnlyTest.php b/tests/Doctrine/Tests/ORM/Functional/ReadOnlyTest.php index 5f9345501ab..17c88d2d4c4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ReadOnlyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ReadOnlyTest.php @@ -90,7 +90,10 @@ class ReadOnlyEntity public $id; /** @column(type="string") */ public $name; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $numericValue; public function __construct($name, $number) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php index 41e412b7312..d709025c19e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1113Test.php @@ -75,7 +75,10 @@ class DDC1113Vehicle */ public $parent; - /** @OneToOne(targetEntity="DDC1113Engine", cascade={"persist", "remove"}) */ + /** + * @var DDC1113Engine + * @OneToOne(targetEntity="DDC1113Engine", cascade={"persist", "remove"}) + */ public $engine; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php index 0578d42f9a5..88af8a6a9aa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1151Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; /** @@ -50,7 +51,10 @@ class DDC1151User */ public $id; - /** @ManyToMany(targetEntity="DDC1151Group") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC1151Group") + */ public $groups; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php index 88132e5a1fd..655beca445a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php @@ -63,12 +63,16 @@ public function testIssue(): void class DDC1193Company { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ public $id; - /** @OneToOne(targetEntity="DDC1193Person", cascade={"persist", "remove"}) */ + /** + * @var DDC1193Person + * @OneToOne(targetEntity="DDC1193Person", cascade={"persist", "remove"}) + */ public $member; } @@ -76,12 +80,16 @@ class DDC1193Company class DDC1193Person { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ public $id; - /** @OneToOne(targetEntity="DDC1193Account", cascade={"persist", "remove"}) */ + /** + * @var DDC1193Account + * @OneToOne(targetEntity="DDC1193Account", cascade={"persist", "remove"}) + */ public $account; } @@ -89,6 +97,7 @@ class DDC1193Person class DDC1193Account { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php index 824170b5b13..1aaff71a7b9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php @@ -159,6 +159,7 @@ private function loadFixture(): void class DDC1335User { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php index 4c54e379a2d..27cd1053245 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1458Test.php @@ -66,9 +66,15 @@ class TestEntity * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ protected $value; - /** @OneToOne(targetEntity="TestAdditionalEntity", inversedBy="entity", orphanRemoval=true, cascade={"persist", "remove"}) */ + /** + * @var TestAdditionalEntity + * @OneToOne(targetEntity="TestAdditionalEntity", inversedBy="entity", orphanRemoval=true, cascade={"persist", "remove"}) + */ protected $additional; public function getValue() @@ -103,7 +109,10 @@ class TestAdditionalEntity * @GeneratedValue(strategy="AUTO") */ protected $id; - /** @OneToOne(targetEntity="TestEntity", mappedBy="additional") */ + /** + * @var TestEntity + * @OneToOne(targetEntity="TestEntity", mappedBy="additional") + */ protected $entity; /** @Column(type="boolean") */ protected $bool; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php index 3a41a31b8c0..c8860b619fe 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1461Test.php @@ -85,6 +85,9 @@ class DDC1461TwitterAccount */ public $id; - /** @OneToOne(targetEntity="DDC1461User", fetch="EAGER") */ + /** + * @var DDC1461User + * @OneToOne(targetEntity="DDC1461User", fetch="EAGER") + */ public $user; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php index 783ec541075..7fb8e8f627a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1514Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -82,7 +83,10 @@ class DDC1514EntityA public $id; /** @Column */ public $title; - /** @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC1514EntityB", mappedBy="entityAFrom") + */ public $entitiesB; /** * @var DDC1514EntityC diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php index b032f9848d2..dda266957ac 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1515Test.php @@ -44,7 +44,10 @@ public function testIssue(): void */ class DDC1515Foo { - /** @OneToOne(targetEntity="DDC1515Bar", inversedBy="foo") @Id */ + /** + * @var DDC1515Bar + * @OneToOne(targetEntity="DDC1515Bar", inversedBy="foo") @Id + */ public $bar; } @@ -61,6 +64,9 @@ class DDC1515Bar */ public $id; - /** @OneToOne(targetEntity="DDC1515Foo", mappedBy="bar") */ + /** + * @var DDC1515Foo + * @OneToOne(targetEntity="DDC1515Foo", mappedBy="bar") + */ public $foo; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php index 12c49439506..7db4670c636 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1548Test.php @@ -76,8 +76,14 @@ class DDC1548Rel */ public $id; - /** @OneToOne(targetEntity="DDC1548E1", mappedBy="rel") */ + /** + * @var DDC1548E1 + * @OneToOne(targetEntity="DDC1548E1", mappedBy="rel") + */ public $e1; - /** @OneToOne(targetEntity="DDC1548E2", mappedBy="rel") */ + /** + * @var DDC1548E2 + * @OneToOne(targetEntity="DDC1548E2", mappedBy="rel") + */ public $e2; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php index b9fce721d5f..94075c70cb6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1690Test.php @@ -116,7 +116,10 @@ class DDC1690Parent extends NotifyBaseEntity /** @Column */ private $name; - /** @OneToOne(targetEntity="DDC1690Child") */ + /** + * @var DDC1690Child + * @OneToOne(targetEntity="DDC1690Child") + */ private $child; public function getId() @@ -160,7 +163,10 @@ class DDC1690Child extends NotifyBaseEntity /** @Column */ private $name; - /** @OneToOne(targetEntity="DDC1690Parent", mappedBy="child") */ + /** + * @var DDC1690Parent + * @OneToOne(targetEntity="DDC1690Parent", mappedBy="child") + */ private $parent; public function getId() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php index 96b7f2689fb..9e72c5f8967 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php @@ -59,7 +59,10 @@ class DDC1757B */ private $id; - /** @OneToOne(targetEntity="DDC1757C") */ + /** + * @var DDC1757C + * @OneToOne(targetEntity="DDC1757C") + */ private $c; } @@ -75,7 +78,10 @@ class DDC1757C */ public $id; - /** @OneToOne(targetEntity="DDC1757D") */ + /** + * @var DDC1757D + * @OneToOne(targetEntity="DDC1757D") + */ private $d; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php index 24782a2deab..3a40f48c7a3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1998Test.php @@ -58,7 +58,10 @@ class DDC1998Entity /** @Id @Column(type="ddc1998") */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $num = 0; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index 6b9a9f7fbfa..cd602a04b32 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -64,6 +64,7 @@ public function testPolymorphicLoading(): void class DDC199ParentClass { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php index 12dec5893b7..0e91c51fffb 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC211Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; class DDC211Test extends OrmFunctionalTestCase @@ -114,7 +115,10 @@ class DDC211Group */ protected $name; - /** @ManyToMany(targetEntity="DDC211User", mappedBy="groups") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC211User", mappedBy="groups") + */ protected $users; public function __construct() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php index 1d5b9967b1f..e7796199f0b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2230Test.php @@ -86,7 +86,10 @@ class DDC2230User /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ public $id; - /** @OneToOne(targetEntity="DDC2230Address") */ + /** + * @var DDC2230Address + * @OneToOne(targetEntity="DDC2230Address") + */ public $address; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php index c7de66fbe16..26f19164e81 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php @@ -100,7 +100,10 @@ class DDC2575Root */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $sampleField; /** @OneToOne(targetEntity="DDC2575A", mappedBy="rootRelation") **/ @@ -150,7 +153,10 @@ class DDC2575B */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $sampleField; public function __construct($id, $value = 0) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php index 4709a8863e5..6fb1dfb3f40 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2579Test.php @@ -83,7 +83,10 @@ class DDC2579Entity */ public $assoc; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $value; public function __construct(DDC2579EntityAssoc $assoc, $value = 0) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php index 185341dc7a6..ac5a66b8d88 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC258Test.php @@ -85,6 +85,7 @@ public function testIssue(): void abstract class DDC258Super { /** + * @var int * @Id @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php index 12aaf6cdb2d..abdd20bfeae 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2759Test.php @@ -78,7 +78,10 @@ class DDC2759Qualification */ public $id; - /** @OneToOne(targetEntity="DDC2759QualificationMetadata", mappedBy="content") */ + /** + * @var DDC2759QualificationMetadata + * @OneToOne(targetEntity="DDC2759QualificationMetadata", mappedBy="content") + */ public $metadata; } @@ -108,7 +111,10 @@ class DDC2759QualificationMetadata */ public $id; - /** @OneToOne(targetEntity="DDC2759Qualification", inversedBy="metadata") */ + /** + * @var DDC2759Qualification + * @OneToOne(targetEntity="DDC2759Qualification", inversedBy="metadata") + */ public $content; /** @OneToMany(targetEntity="DDC2759MetadataCategory", mappedBy="metadata") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php index 31072c87fae..ed08a015014 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2775Test.php @@ -65,6 +65,7 @@ public function testIssueCascadeRemove(): void abstract class Role { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ @@ -97,6 +98,7 @@ class AdminRole extends Role class Authorization { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ @@ -121,6 +123,7 @@ class Authorization class User { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2931Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2931Test.php index f218d3d2803..ee6dc4f7d08 100755 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2931Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2931Test.php @@ -96,13 +96,22 @@ class DDC2931User /** @Id @Column(type="integer") @GeneratedValue(strategy="AUTO") */ public $id; - /** @OneToOne(targetEntity="DDC2931User", inversedBy="child") */ + /** + * @var DDC2931User + * @OneToOne(targetEntity="DDC2931User", inversedBy="child") + */ public $parent; - /** @OneToOne(targetEntity="DDC2931User", mappedBy="parent") */ + /** + * @var DDC2931User + * @OneToOne(targetEntity="DDC2931User", mappedBy="parent") + */ public $child; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $value = 0; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php index c79d29280d3..0c3e3afc85f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2996Test.php @@ -54,7 +54,10 @@ class DDC2996User * @Column(type="integer") */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $counter = 0; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php index 9d1f09c5d3c..83a51f3438c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3042Test.php @@ -49,25 +49,55 @@ class DDC3042Foo * @GeneratedValue */ public $field; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field1; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field2; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field3; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field4; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field5; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field6; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field7; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field8; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field9; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $field10; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php index 9882e0b4942..b5b4a40d487 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3330Test.php @@ -72,6 +72,7 @@ private function createBuildingAndHalls(): void class DDC3330_Building { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ @@ -93,6 +94,7 @@ public function addHall(DDC3330_Hall $hall): void class DDC3330_Hall { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php index cb11361347f..63592258946 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php @@ -104,6 +104,7 @@ public function getAttributes() class DDC3785_Attribute { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php index b0f4b64c737..09bad77faff 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php @@ -37,6 +37,7 @@ public function testIssue(): void class DDC425Entity { /** + * @var int * @Id @Column(type="integer") * @GeneratedValue */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php index 51f53efb51b..16edc38289f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php @@ -65,6 +65,7 @@ public function testExplicitPolicy(): void class DDC444User { /** + * @var int * @Id @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index cfb9778e110..ffe4f555528 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -106,7 +106,10 @@ class DDC522Customer /** @Column */ public $name; - /** @OneToOne(targetEntity="DDC522Cart", mappedBy="customer") */ + /** + * @var DDC522Cart + * @OneToOne(targetEntity="DDC522Cart", mappedBy="customer") + */ public $cart; } @@ -121,7 +124,10 @@ class DDC522Cart */ public $id; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $total; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php index 5e2a147686c..ab0bd269a6b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php @@ -89,7 +89,10 @@ class DDC633Appointment */ public $id; - /** @OneToOne(targetEntity="DDC633Patient", inversedBy="appointment", fetch="EAGER") */ + /** + * @var DDC633Patient + * @OneToOne(targetEntity="DDC633Patient", inversedBy="appointment", fetch="EAGER") + */ public $patient; } @@ -106,6 +109,9 @@ class DDC633Patient */ public $id; - /** @OneToOne(targetEntity="DDC633Appointment", mappedBy="patient") */ + /** + * @var DDC633Appointment + * @OneToOne(targetEntity="DDC633Appointment", mappedBy="patient") + */ public $appointment; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php index 4ceb40521a5..b8a3d6a0c24 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -96,6 +97,9 @@ class DDC698Privilege */ protected $name; - /** @ManyToMany(targetEntity="DDC698Role", mappedBy="privilege") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC698Role", mappedBy="privilege") + */ protected $roles; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php index d396223340e..e4a30e94b3c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use function strtolower; @@ -78,7 +79,10 @@ class DDC719Group extends Entity */ protected $children = null; - /** @ManyToMany(targetEntity="DDC719Group", mappedBy="children") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC719Group", mappedBy="children") + */ protected $parents = null; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php index 216570f2da9..e5544dc1420 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC729Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Tools\SchemaTool; use Doctrine\Tests\OrmFunctionalTestCase; @@ -178,7 +179,10 @@ class DDC729A */ public $id; - /** @ManyToMany(targetEntity="DDC729B", inversedBy="related") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC729B", inversedBy="related") + */ public $related; public function __construct() @@ -200,7 +204,10 @@ class DDC729B */ public $id; - /** @ManyToMany(targetEntity="DDC729B", mappedBy="related") */ + /** + * @psalm-var Collection + * @ManyToMany(targetEntity="DDC729B", mappedBy="related") + */ public $related; public function __construct() diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php index e631add8dea..8bea4733dfc 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php @@ -222,10 +222,16 @@ public function __construct($name) */ class DDC832JoinedTreeIndex extends DDC832JoinedIndex { - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $lft; - /** @Column(type="integer") */ + /** + * @var int + * @Column(type="integer") + */ public $rgt; public function __construct($name, $lft, $rgt) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php index ddd0649c328..b7ed5c05253 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php @@ -127,7 +127,10 @@ class DDC837Class1 extends DDC837Super */ public $description; - /** @OneToOne(targetEntity="DDC837Aggregate") */ + /** + * @var DDC837Aggregate + * @OneToOne(targetEntity="DDC837Aggregate") + */ public $aggregate; } @@ -151,7 +154,10 @@ class DDC837Class2 extends DDC837Super /** @Column(name="text", type="text") */ public $text; - /** @OneToOne(targetEntity="DDC837Aggregate") */ + /** + * @var DDC837Aggregate + * @OneToOne(targetEntity="DDC837Aggregate") + */ public $aggregate; } From 416f35dba95f40c574926c7686057cae14ce0a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 14 Feb 2021 08:38:17 +0100 Subject: [PATCH 22/27] Manually fix cs --- .../Functional/OneToOneEagerLoadingTest.php | 5 ++- .../ORM/Functional/Ticket/DDC599Test.php | 12 +++++-- .../ORM/Functional/Ticket/DDC618Test.php | 17 ++++++--- .../ORM/Functional/Ticket/DDC6303Test.php | 20 +++++++++-- .../ORM/Functional/Ticket/DDC6460Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC656Test.php | 8 ++--- .../ORM/Functional/Ticket/DDC698Test.php | 13 ++++--- .../ORM/Functional/Ticket/DDC719Test.php | 36 +++++++++++-------- .../ORM/Functional/Ticket/DDC735Test.php | 9 +++-- .../ORM/Functional/Ticket/DDC809Test.php | 19 ++++++---- .../ORM/Functional/Ticket/DDC832Test.php | 10 +++--- .../ORM/Functional/Ticket/DDC837Test.php | 17 ++++++--- .../ORM/Functional/Ticket/DDC849Test.php | 5 +++ .../ORM/Functional/Ticket/DDC881Test.php | 22 ++++++++---- 14 files changed, 143 insertions(+), 60 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php index 16597c13e27..4a8bf25203f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php @@ -376,7 +376,10 @@ class TrainOrder /** @id @generatedValue @column(type="integer") */ public $id; - /** @OneToOne(targetEntity = "Train", fetch = "EAGER") */ + /** + * @var Train + * @OneToOne(targetEntity="Train", fetch="EAGER") + */ public $train; public function __construct(Train $train) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php index 86da2a24d7d..b1b2f629054 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC599Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -93,7 +94,10 @@ class DDC599Item */ public $id; - /** @OneToMany(targetEntity="DDC599Child", mappedBy="parent", cascade={"remove"}) */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="DDC599Child", mappedBy="parent", cascade={"remove"}) + */ protected $children; public function __construct() @@ -101,7 +105,10 @@ public function __construct() $this->children = new ArrayCollection(); } - public function getChildren() + /** + * @psalm-return Collection + */ + public function getChildren(): Collection { return $this->children; } @@ -133,6 +140,7 @@ class DDC599Child public $id; /** + * @var DDC599Item * @ManyToOne(targetEntity="DDC599Item", inversedBy="children") * @JoinColumn(name="parentId", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php index bf7e9a84ddb..aa5edb04051 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC618Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Query; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -153,7 +154,10 @@ class DDC618Author */ public $name; - /** @OneToMany(targetEntity="DDC618Book", mappedBy="author", cascade={"persist"}) */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="DDC618Book", mappedBy="author", cascade={"persist"}) + */ public $books; public function __construct() @@ -161,7 +165,7 @@ public function __construct() $this->books = new ArrayCollection(); } - public function addBook($title): void + public function addBook(string $title): void { $book = new DDC618Book($title, $this); $this->books[] = $book; @@ -174,12 +178,17 @@ public function addBook($title): void class DDC618Book { /** - * @Id @GeneratedValue + * @var int + * @Id + * @GeneratedValue * @Column(type="integer") */ public $id; - /** @column(type="string") */ + /** + * @var string + * @Column(type="string") + */ public $title; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php index ff428768a5a..915b375e913 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6303Test.php @@ -97,7 +97,12 @@ private function assertHydratedEntitiesSameToPersistedOnes(array $persistedEntit */ abstract class DDC6303BaseClass { - /** @Id @Column(type="string") @GeneratedValue(strategy="NONE") */ + /** + * @var string + * @Id + * @Column(type="string") + * @GeneratedValue(strategy="NONE") + */ public $id; } @@ -105,11 +110,14 @@ abstract class DDC6303BaseClass class DDC6303ChildA extends DDC6303BaseClass { /** - * @var string + * @var mixed * @Column(type="string") */ private $originalData; + /** + * @param mixed $originalData + */ public function __construct(string $id, $originalData) { $this->id = $id; @@ -120,9 +128,15 @@ public function __construct(string $id, $originalData) /** @Entity @Table */ class DDC6303ChildB extends DDC6303BaseClass { - /** @Column(type="simple_array", nullable=true) */ + /** + * @var mixed[] + * @Column(type="simple_array", nullable=true) + */ private $originalData; + /** + * @param mixed[] $originalData + */ public function __construct(string $id, array $originalData) { $this->id = $id; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php index 87c14358b77..7519987da58 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC6460Test.php @@ -97,7 +97,10 @@ class DDC6460Entity */ public $id; - /** @Embedded(class = "DDC6460Embeddable") */ + /** + * @var DDC6460Embeddable + * @Embedded(class = "DDC6460Embeddable") + */ public $embedded; } @@ -114,6 +117,9 @@ class DDC6460ParentEntity */ public $id; - /** @ManyToOne(targetEntity = "DDC6460Entity", fetch="EXTRA_LAZY", cascade={"persist"}) */ + /** + * @var DDC6460Entity + * @ManyToOne(targetEntity="DDC6460Entity", fetch="EXTRA_LAZY", cascade={"persist"}) + */ public $lazyLoaded; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php index 1327af432bb..09e54250448 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC656Test.php @@ -74,22 +74,22 @@ class DDC656Entity */ public $specificationId; - public function getName() + public function getName(): string { return $this->name; } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } - public function getType() + public function getType(): string { return $this->type; } - public function setType($type): void + public function setType(string $type): void { $this->type = $type; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php index b8a3d6a0c24..61824c03b8a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC698Test.php @@ -49,8 +49,10 @@ public function testTicket(): void class DDC698Role { /** - * @Id @Column(name="roleID", type="integer") - * @GeneratedValue(strategy="AUTO") + * @var int + * @Id + * @Column(name="roleID", type="integer") + * @GeneratedValue(strategy="AUTO") */ protected $roleID; @@ -69,6 +71,7 @@ class DDC698Role /** + * @var Collection * @ManyToMany(targetEntity="DDC698Privilege", inversedBy="roles") * @JoinTable(name="RolePrivileges", * joinColumns={@JoinColumn(name="roleID", referencedColumnName="roleID")}, @@ -86,8 +89,10 @@ class DDC698Role class DDC698Privilege { /** - * @Id @Column(name="privilegeID", type="integer") - * @GeneratedValue(strategy="AUTO") + * @var int + * @Id + * @Column(name="privilegeID", type="integer") + * @GeneratedValue(strategy="AUTO") */ protected $privilegeID; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php index e4a30e94b3c..b6a316827de 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC719Test.php @@ -41,12 +41,14 @@ public function testIsEmptySqlGeneration(): void class Entity { /** - * @Id @GeneratedValue + * @var int + * @Id + * @GeneratedValue * @Column(type="integer") */ protected $id; - public function getId() + public function getId(): int { return $this->id; } @@ -71,6 +73,7 @@ class DDC719Group extends Entity protected $description; /** + * @psalm-var Collection * @ManyToMany(targetEntity="DDC719Group", inversedBy="parents") * @JoinTable(name="groups_groups", * joinColumns={@JoinColumn(name="parent_id", referencedColumnName="id")}, @@ -85,9 +88,6 @@ class DDC719Group extends Entity */ protected $parents = null; - /** - * construct - */ public function __construct() { parent::__construct(); @@ -118,40 +118,46 @@ public function addChannel(Channel $child): void } } - /** - * getter & setter - */ - public function getName() + public function getName(): string { return $this->name; } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } - public function getDescription() + public function getDescription(): string { return $this->description; } - public function setDescription($description): void + public function setDescription(string $description): void { $this->description = $description; } - public function getChildren() + /** + * @psalm-return Collection + */ + public function getChildren(): Collection { return $this->children; } - public function getParents() + /** + * @psalm-return Collection + */ + public function getParents(): Collection { return $this->parents; } - public function getChannels() + /** + * @psalm-return Collection + */ + public function getChannels(): Collection { return $this->channels; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php index 6b41a29bde0..4cfb36c10bd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC735Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -72,6 +73,7 @@ class DDC735Product protected $id; /** + * @psalm-var Collection * @OneToMany( * targetEntity="DDC735Review", * mappedBy="product", @@ -86,7 +88,10 @@ public function __construct() $this->reviews = new ArrayCollection(); } - public function getReviews() + /** + * @psalm-return Collection + */ + public function getReviews(): Collection { return $this->reviews; } @@ -127,7 +132,7 @@ public function __construct(DDC735Product $product) $product->addReview($this); } - public function getId() + public function getId(): int { return $this->id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php index 994ce7979e3..d6b52085cc5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC809Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use function count; @@ -50,7 +51,7 @@ public function testIssue(): void $result = $this->_em->createQueryBuilder() ->select('Variant, SpecificationValue') ->from(DDC809Variant::class, 'Variant') - ->leftJoin('Variant.SpecificationValues', 'SpecificationValue') + ->leftJoin('Variant.specificationValues', 'SpecificationValue') ->getQuery() ->getResult(); @@ -66,12 +67,14 @@ public function testIssue(): void class DDC809Variant { /** + * @var int * @Column(name="variant_id", type="integer") * @Id */ protected $variantId; /** + * @psalm-var Collection * @ManyToMany(targetEntity="DDC809SpecificationValue", inversedBy="Variants") * @JoinTable(name="var_spec_value_test", * joinColumns={ @@ -82,11 +85,14 @@ class DDC809Variant * } * ) */ - protected $SpecificationValues; + protected $specificationValues; - public function getSpecificationValues() + /** + * @psalm-return Collection + */ + public function getSpecificationValues(): Collection { - return $this->SpecificationValues; + return $this->specificationValues; } } @@ -97,14 +103,15 @@ public function getSpecificationValues() class DDC809SpecificationValue { /** + * @var int * @Column(name="specification_value_id", type="integer") * @Id */ protected $specificationValueId; /** - * @var Variant + * @psalm-var Collection * @ManyToMany(targetEntity="DDC809Variant", mappedBy="SpecificationValues") */ - protected $Variants; + protected $variants; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php index 8bea4733dfc..a9623d072f1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC832Test.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\DBAL\Logging\EchoSQLLogger; -use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -37,7 +36,6 @@ protected function setUp(): void public function tearDown(): void { - /** @var AbstractSchemaManager $sm */ $platform = $this->_em->getConnection()->getDatabasePlatform(); $sm = $this->_em->getConnection()->getSchemaManager(); @@ -170,12 +168,13 @@ class DDC832Like public $word; /** + * @var int * @Version * @Column(type="integer") */ public $version; - public function __construct($word) + public function __construct(string $word) { $this->word = $word; } @@ -205,12 +204,13 @@ class DDC832JoinedIndex public $name; /** + * @var int * @Version * @Column(type="integer") */ public $version; - public function __construct($name) + public function __construct(string $name) { $this->name = $name; } @@ -234,7 +234,7 @@ class DDC832JoinedTreeIndex extends DDC832JoinedIndex */ public $rgt; - public function __construct($name, $lft, $rgt) + public function __construct(string $name, int $lft, int $rgt) { $this->name = $name; $this->lft = $lft; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php index b7ed5c05253..42bb0d39d63 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC837Test.php @@ -104,7 +104,9 @@ public function testIssue(): void abstract class DDC837Super { /** - * @Id @Column(name="id", type="integer") + * @var int + * @Id + * @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ public $id; @@ -151,7 +153,10 @@ class DDC837Class2 extends DDC837Super */ public $description; - /** @Column(name="text", type="text") */ + /** + * @var string + * @Column(name="text", type="text") + */ public $text; /** @@ -187,7 +192,9 @@ class DDC837Class3 extends DDC837Super class DDC837Aggregate { /** - * @Id @Column(name="id", type="integer") + * @var int + * @Id + * @Column(name="id", type="integer") * @GeneratedValue */ public $id; @@ -198,12 +205,12 @@ class DDC837Aggregate */ protected $sysname; - public function __construct($sysname) + public function __construct(string $sysname) { $this->sysname = $sysname; } - public function getSysname() + public function getSysname(): string { return $this->sysname; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php index 4a7df435c13..3fbbcd3c9a5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC849Test.php @@ -12,8 +12,13 @@ class DDC849Test extends OrmFunctionalTestCase { + /** @var CmsUser */ private $user; + + /** @var CmsGroup */ private $group1; + + /** @var CmsGroup */ private $group2; protected function setUp(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php index 59b413292e1..138907504ab 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC881Test.php @@ -114,20 +114,25 @@ class DDC881User * @GeneratedValue(strategy="AUTO") */ private $id; + /** * @var string * @Column(type="string") */ private $name; - /** @OneToMany(targetEntity="DDC881PhoneNumber",mappedBy="id") */ + + /** + * @psalm-var Collection + * @OneToMany(targetEntity="DDC881PhoneNumber",mappedBy="id") + */ private $phoneNumbers; - public function getName() + public function getName(): string { return $this->name; } - public function setName($name): void + public function setName(string $name): void { $this->name = $name; } @@ -159,7 +164,7 @@ class DDC881PhoneNumber private $phonenumber; /** - * @var Collection + * @psalm-var Collection * @OneToMany(targetEntity="DDC881PhoneCall", mappedBy="phonenumber") */ private $calls; @@ -169,7 +174,7 @@ public function __construct() $this->calls = new ArrayCollection(); } - public function setId($id): void + public function setId(int $id): void { $this->id = $id; } @@ -179,12 +184,15 @@ public function setUser(DDC881User $user): void $this->user = $user; } - public function setPhoneNumber($phoneNumber): void + public function setPhoneNumber(string $phoneNumber): void { $this->phonenumber = $phoneNumber; } - public function getCalls() + /** + * @psalm-var Collection + */ + public function getCalls(): Collection { return $this->calls; } From 4aece04ae79827373822dea11195cd2267357f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 15 Feb 2021 23:56:11 +0100 Subject: [PATCH 23/27] Automatically fix cs --- tests/Doctrine/Tests/Models/CMS/CmsAddress.php | 1 + tests/Doctrine/Tests/Models/CMS/CmsComment.php | 2 ++ tests/Doctrine/Tests/Models/CMS/CmsEmployee.php | 1 + tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php | 1 + tests/Doctrine/Tests/Models/Cache/Login.php | 1 + tests/Doctrine/Tests/Models/Company/CompanyManager.php | 1 + tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php | 1 + tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php | 1 + tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php | 2 ++ tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php | 1 + tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php | 1 + tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php | 2 ++ tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php | 2 ++ tests/Doctrine/Tests/Models/Forum/ForumBoard.php | 1 + .../Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php | 1 + tests/Doctrine/Tests/Models/GeoNames/Admin1.php | 1 + tests/Doctrine/Tests/Models/Pagination/Logo.php | 1 + tests/Doctrine/Tests/Models/Quote/NumericEntity.php | 1 + tests/Doctrine/Tests/Models/Quote/Phone.php | 1 + tests/Doctrine/Tests/Models/Routing/RoutingLeg.php | 2 ++ tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php | 1 + .../Models/ValueConversionType/OwningManyToOneEntity.php | 1 + .../ValueConversionType/OwningManyToOneExtraLazyEntity.php | 1 + .../Models/ValueConversionType/OwningOneToOneEntity.php | 1 + .../Tests/ORM/Functional/AdvancedAssociationTest.php | 5 +++++ .../Tests/ORM/Functional/ClassTableInheritanceTest2.php | 1 + tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php | 1 + .../Tests/ORM/Functional/OneToOneEagerLoadingTest.php | 1 + .../Functional/OneToOneSelfReferentialAssociationTest.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php | 4 ++++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php | 1 + tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php | 2 ++ tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php | 1 + 51 files changed, 71 insertions(+) diff --git a/tests/Doctrine/Tests/Models/CMS/CmsAddress.php b/tests/Doctrine/Tests/Models/CMS/CmsAddress.php index 56c219732e3..4f3f866d048 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsAddress.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsAddress.php @@ -85,6 +85,7 @@ class CmsAddress public $street; /** + * @var CmsUser * @OneToOne(targetEntity="CmsUser", inversedBy="address") * @JoinColumn(referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/CMS/CmsComment.php b/tests/Doctrine/Tests/Models/CMS/CmsComment.php index 17075012909..75a41c2ee3c 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsComment.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsComment.php @@ -11,6 +11,7 @@ class CmsComment { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") @@ -27,6 +28,7 @@ class CmsComment */ public $text; /** + * @var CmsArticle * @ManyToOne(targetEntity="CmsArticle", inversedBy="comments") * @JoinColumn(name="article_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php b/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php index c8835790ce9..dbbe5f8f71b 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsEmployee.php @@ -24,6 +24,7 @@ class CmsEmployee private $name; /** + * @var CmsEmployee * @OneToOne(targetEntity="CmsEmployee") * @JoinColumn(name="spouse_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php b/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php index 7f24c63246c..5ff4c4a40c3 100644 --- a/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php +++ b/tests/Doctrine/Tests/Models/CMS/CmsPhonenumber.php @@ -13,6 +13,7 @@ class CmsPhonenumber /** @Id @Column(length=50) */ public $phonenumber; /** + * @var CmsUser * @ManyToOne(targetEntity="CmsUser", inversedBy="phonenumbers", cascade={"merge"}) * @JoinColumn(name="user_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/Cache/Login.php b/tests/Doctrine/Tests/Models/Cache/Login.php index 01f341d76b3..3e5fee2f71c 100644 --- a/tests/Doctrine/Tests/Models/Cache/Login.php +++ b/tests/Doctrine/Tests/Models/Cache/Login.php @@ -22,6 +22,7 @@ class Login public $name; /** + * @var Token * @ManyToOne(targetEntity="Token", cascade={"persist", "remove"}, inversedBy="logins") * @JoinColumn(name="token_id", referencedColumnName="token") */ diff --git a/tests/Doctrine/Tests/Models/Company/CompanyManager.php b/tests/Doctrine/Tests/Models/Company/CompanyManager.php index 341d726f0fa..02ae9781e41 100644 --- a/tests/Doctrine/Tests/Models/Company/CompanyManager.php +++ b/tests/Doctrine/Tests/Models/Company/CompanyManager.php @@ -19,6 +19,7 @@ class CompanyManager extends CompanyEmployee private $title; /** + * @var CompanyCar * @OneToOne(targetEntity="CompanyCar", cascade={"persist"}) * @JoinColumn(name="car_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php b/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php index 5def2d0ff5d..db344373c10 100644 --- a/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php +++ b/tests/Doctrine/Tests/Models/DDC117/DDC117ApproveChanges.php @@ -18,6 +18,7 @@ class DDC117ApproveChanges private $id; /** + * @var DDC117ArticleDetails * @ManyToOne(targetEntity="DDC117ArticleDetails") * @JoinColumn(name="details_id", referencedColumnName="article_id") */ diff --git a/tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php b/tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php index 6a5c763d4bd..c7eeaa179ee 100644 --- a/tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php +++ b/tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php @@ -13,6 +13,7 @@ trait DDC1872ExampleTrait protected $foo; /** + * @var DDC1872Bar * @OneToOne(targetEntity="DDC1872Bar", cascade={"persist", "merge"}) * @JoinColumn(name="example_trait_bar_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php index 92a62d85f18..8159cfd3e95 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCart.php @@ -16,6 +16,7 @@ class ECommerceCart { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue @@ -26,6 +27,7 @@ class ECommerceCart private $payment; /** + * @var ECommerceCustomer * @OneToOne(targetEntity="ECommerceCustomer", inversedBy="cart") * @JoinColumn(name="customer_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php index 32e332f7ce3..226472d6cd2 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php @@ -39,6 +39,7 @@ class ECommerceCategory private $children; /** + * @var ECommerceCategory * @ManyToOne(targetEntity="ECommerceCategory", inversedBy="children") * @JoinColumn(name="parent_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php index f63a7fb5840..af2ba454c3b 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceCustomer.php @@ -14,6 +14,7 @@ class ECommerceCustomer { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php index eca5c19bb01..49f8ce3fa37 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceFeature.php @@ -13,6 +13,7 @@ class ECommerceFeature { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue @@ -23,6 +24,7 @@ class ECommerceFeature private $description; /** + * @var ECommerceProduct * @ManyToOne(targetEntity="ECommerceProduct", inversedBy="features") * @JoinColumn(name="product_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php index b95de138528..57b77617687 100644 --- a/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php +++ b/tests/Doctrine/Tests/Models/ECommerce/ECommerceProduct.php @@ -16,6 +16,7 @@ class ECommerceProduct { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue @@ -29,6 +30,7 @@ class ECommerceProduct private $name; /** + * @var ECommerceShipping * @OneToOne(targetEntity="ECommerceShipping", cascade={"persist"}) * @JoinColumn(name="shipping_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php index eda1715036c..b5c7a23ef4d 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumBoard.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumBoard.php @@ -24,6 +24,7 @@ class ForumBoard */ public $position; /** + * @var ForumCategory * @ManyToOne(targetEntity="ForumCategory", inversedBy="boards") * @JoinColumn(name="category_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php b/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php index d58a5f8763c..fd6d5c50827 100644 --- a/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php +++ b/tests/Doctrine/Tests/Models/Generic/NonAlphaColumnsEntity.php @@ -11,6 +11,7 @@ class NonAlphaColumnsEntity { /** + * @var int * @Id * @Column(type="integer", name="`simple-entity-id`") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/GeoNames/Admin1.php b/tests/Doctrine/Tests/Models/GeoNames/Admin1.php index 39981b25628..65cc5d0befa 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Admin1.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Admin1.php @@ -12,6 +12,7 @@ class Admin1 { /** + * @var int * @Id * @Column(type="integer", length=25) * @GeneratedValue(strategy="NONE") diff --git a/tests/Doctrine/Tests/Models/Pagination/Logo.php b/tests/Doctrine/Tests/Models/Pagination/Logo.php index 2a2748074dd..5ac0e96a8b6 100644 --- a/tests/Doctrine/Tests/Models/Pagination/Logo.php +++ b/tests/Doctrine/Tests/Models/Pagination/Logo.php @@ -38,6 +38,7 @@ class Logo public $image_width; /** + * @var Company * @OneToOne(targetEntity="Company", inversedBy="logo", cascade={"persist"}) * @JoinColumn(name="company_id") */ diff --git a/tests/Doctrine/Tests/Models/Quote/NumericEntity.php b/tests/Doctrine/Tests/Models/Quote/NumericEntity.php index ac50f304bcb..9b0f7aa47c0 100644 --- a/tests/Doctrine/Tests/Models/Quote/NumericEntity.php +++ b/tests/Doctrine/Tests/Models/Quote/NumericEntity.php @@ -11,6 +11,7 @@ class NumericEntity { /** + * @var int * @Id * @Column(type="integer", name="`1:1`") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/Models/Quote/Phone.php b/tests/Doctrine/Tests/Models/Quote/Phone.php index 950c9d757d0..e9e14bfaa59 100644 --- a/tests/Doctrine/Tests/Models/Quote/Phone.php +++ b/tests/Doctrine/Tests/Models/Quote/Phone.php @@ -17,6 +17,7 @@ class Phone public $number; /** + * @var User * @ManyToOne(targetEntity="User", inversedBy="phones") * @JoinColumn(name="`user-id`", referencedColumnName="`user-id`") */ diff --git a/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php b/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php index b6a2db8fb0e..305739d228c 100644 --- a/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php +++ b/tests/Doctrine/Tests/Models/Routing/RoutingLeg.php @@ -16,12 +16,14 @@ class RoutingLeg public $id; /** + * @var RoutingLocation * @ManyToOne(targetEntity="RoutingLocation") * @JoinColumn(name="from_id", referencedColumnName="id") */ public $fromLocation; /** + * @var RoutingLocation * @ManyToOne(targetEntity="RoutingLocation") * @JoinColumn(name="to_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php index 664657f2e0d..e1a1628b183 100644 --- a/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php +++ b/tests/Doctrine/Tests/Models/Routing/RoutingRouteBooking.php @@ -18,6 +18,7 @@ class RoutingRouteBooking public $id; /** + * @var RoutingRoute * @ManyToOne(targetEntity="RoutingRoute", inversedBy="bookings") * @JoinColumn(name="route_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneEntity.php index 55e7c4e51f8..1b5d2120ab8 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneEntity.php @@ -17,6 +17,7 @@ class OwningManyToOneEntity public $id2; /** + * @var InversedOneToManyEntity * @ManyToOne(targetEntity="InversedOneToManyEntity", inversedBy="associatedEntities") * @JoinColumn(name="associated_id", referencedColumnName="id1") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneExtraLazyEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneExtraLazyEntity.php index 549bc0b9cbc..831136b21b5 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneExtraLazyEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/OwningManyToOneExtraLazyEntity.php @@ -17,6 +17,7 @@ class OwningManyToOneExtraLazyEntity public $id2; /** + * @var InversedOneToManyExtraLazyEntity * @ManyToOne(targetEntity="InversedOneToManyExtraLazyEntity", inversedBy="associatedEntities") * @JoinColumn(name="associated_id", referencedColumnName="id1") */ diff --git a/tests/Doctrine/Tests/Models/ValueConversionType/OwningOneToOneEntity.php b/tests/Doctrine/Tests/Models/ValueConversionType/OwningOneToOneEntity.php index 611db24ccdd..4ffed7eeb28 100644 --- a/tests/Doctrine/Tests/Models/ValueConversionType/OwningOneToOneEntity.php +++ b/tests/Doctrine/Tests/Models/ValueConversionType/OwningOneToOneEntity.php @@ -17,6 +17,7 @@ class OwningOneToOneEntity public $id2; /** + * @var InversedOneToOneEntity * @OneToOne(targetEntity="InversedOneToOneEntity", inversedBy="associatedEntity") * @JoinColumn(name="associated_id", referencedColumnName="id1") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php index 9f315d8bd15..099225319f5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedAssociationTest.php @@ -327,6 +327,7 @@ class Phrase public const CLASS_NAME = self::class; /** + * @var int * @Id * @Column(type="integer", name="phrase_id") * @GeneratedValue(strategy="AUTO") @@ -340,6 +341,7 @@ class Phrase private $phrase; /** + * @var PhraseType * @ManyToOne(targetEntity="PhraseType") * @JoinColumn(name="phrase_type_id", referencedColumnName="phrase_type_id") */ @@ -399,6 +401,7 @@ class PhraseType public const CLASS_NAME = self::class; /** + * @var int * @Id * @Column(type="integer", name="phrase_type_id") * @GeneratedValue(strategy="AUTO") @@ -470,6 +473,7 @@ class Definition public const CLASS_NAME = self::class; /** + * @var int * @Id * @Column(type="integer", name="definition_id") * @GeneratedValue(strategy="AUTO") @@ -477,6 +481,7 @@ class Definition private $id; /** + * @var Phrase * @ManyToOne(targetEntity="Phrase") * @JoinColumn(name="definition_phrase_id", referencedColumnName="phrase_id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php index 764f568d702..1e54bcd14a4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest2.php @@ -153,6 +153,7 @@ class CTIRelated private $id; /** + * @var CTIParent * @OneToOne(targetEntity="CTIParent") * @JoinColumn(name="ctiparent_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php index 097d7249a5f..0b1f77d061f 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php @@ -161,6 +161,7 @@ class DefaultValueAddress public $street; /** + * @var DefaultValueUser * @OneToOne(targetEntity="DefaultValueUser") * @JoinColumn(name="user_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php index 4a8bf25203f..c940e46fcd0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php @@ -357,6 +357,7 @@ class Waggon /** @id @generatedValue @column(type="integer") */ public $id; /** + * @var Train * @ManyToOne(targetEntity="Train", inversedBy="waggons", fetch="EAGER") * @JoinColumn(nullable=false) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php index ee847e5226f..47426acbbea 100644 --- a/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/OneToOneSelfReferentialAssociationTest.php @@ -155,11 +155,13 @@ class MultiSelfReference /** @Id @GeneratedValue(strategy="AUTO") @Column(type="integer") */ private $id; /** + * @var MultiSelfReference * @OneToOne(targetEntity="MultiSelfReference", cascade={"persist"}) * @JoinColumn(name="other1", referencedColumnName="id") */ private $other1; /** + * @var MultiSelfReference * @OneToOne(targetEntity="MultiSelfReference", cascade={"persist"}) * @JoinColumn(name="other2", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php index 1aaff71a7b9..71ec2fc0f11 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1335Test.php @@ -212,6 +212,7 @@ class DDC1335Phone public $numericalValue; /** + * @var DDC1335User * @ManyToOne(targetEntity="DDC1335User", inversedBy="phones") * @JoinColumn(name="user_id", referencedColumnName="id", nullable = false) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php index dda2f839688..727bb60670e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1392Test.php @@ -84,6 +84,7 @@ class DDC1392Picture private $pictureId; /** + * @var DDC1392File * @ManyToOne(targetEntity="DDC1392File", cascade={"persist", "remove"}) * @JoinColumn(name="file_id", referencedColumnName="file_id") */ @@ -120,6 +121,7 @@ public function getFile() class DDC1392File { /** + * @var int * @Column(name="file_id", type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php index b7f9a56a30c..b7c1606a275 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1436Test.php @@ -71,6 +71,7 @@ class DDC1436Page */ protected $id; /** + * @var DDC1436Page * @ManyToOne(targetEntity="DDC1436Page") * @JoinColumn(name="pid", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php index 03860ce1173..dd0e2615041 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1509Test.php @@ -66,6 +66,7 @@ public function testFailingCase(): void class DDC1509Picture { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") @@ -128,6 +129,7 @@ public function setThumbnail($thumbnail): void class DDC1509AbstractFile { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php index ed82ae257e4..48217e0a5ad 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1526Test.php @@ -56,6 +56,7 @@ public function testIssue(): void class DDC1526Menu { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php index 3f8d1b6cf83..a94a35a6225 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1719Test.php @@ -100,6 +100,7 @@ public function testCreateRetrieveUpdateDelete(): void class DDC1719SimpleEntity { /** + * @var int * @Id * @Column(type="integer", name="`simple-entity-id`") * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php index 9e72c5f8967..1b43010895b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1757Test.php @@ -40,6 +40,7 @@ public function testFailingCase(): void class DDC1757A { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") @@ -53,6 +54,7 @@ class DDC1757A class DDC1757B { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") @@ -72,6 +74,7 @@ class DDC1757B class DDC1757C { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") @@ -91,6 +94,7 @@ class DDC1757C class DDC1757D { /** + * @var int * @Column(type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php index cd602a04b32..e4de2638ea2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC199Test.php @@ -102,6 +102,7 @@ class DDC199RelatedClass public $relatedData; /** + * @var DDC199ParentClass * @ManyToOne(targetEntity="DDC199ParentClass", inversedBy="relatedEntities") * @JoinColumn(name="parent_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php index 316bb576596..a3c97f38058 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2182Test.php @@ -63,6 +63,7 @@ class DDC2182OptionChild private $id; /** + * @var DDC2182OptionParent * @ManyToOne(targetEntity="DDC2182OptionParent") * @JoinColumn(referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php index 70abe331299..48c4e55ede6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2256Test.php @@ -87,6 +87,7 @@ class DDC2256User public $name; /** + * @var DDC2256Group * @ManyToOne(targetEntity="DDC2256Group", inversedBy="users")A * @JoinColumn(name="group_id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php index 251699d0db9..52dccd5c757 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC237Test.php @@ -86,6 +86,7 @@ class DDC237EntityX */ public $data; /** + * @var DDC237EntityY * @OneToOne(targetEntity="DDC237EntityY") * @JoinColumn(name="y_id", referencedColumnName="id") */ @@ -127,6 +128,7 @@ class DDC237EntityZ public $data; /** + * @var DDC237EntityY * @OneToOne(targetEntity="DDC237EntityY") * @JoinColumn(name="y_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php index 26f19164e81..1b2e5c91f44 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2575Test.php @@ -129,6 +129,7 @@ class DDC2575A public $rootRelation; /** + * @var DDC2575B * @ManyToOne(targetEntity="DDC2575B") * @JoinColumn(name="b_id", referencedColumnName="id", nullable=FALSE, onDelete="CASCADE") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php index 476911e1449..ce67b44e2d5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC279Test.php @@ -90,6 +90,7 @@ abstract class DDC279EntityXAbstract class DDC279EntityX extends DDC279EntityXAbstract { /** + * @var DDC279EntityY * @OneToOne(targetEntity="DDC279EntityY") * @JoinColumn(name="y_id", referencedColumnName="id") */ @@ -111,6 +112,7 @@ class DDC279EntityY public $data; /** + * @var DDC279EntityZ * @OneToOne(targetEntity="DDC279EntityZ") * @JoinColumn(name="z_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php index 6329df3c260..1f0d8c555ab 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC345Test.php @@ -132,12 +132,14 @@ class DDC345Membership public $id; /** + * @var DDC345User * @OneToOne(targetEntity="DDC345User", inversedBy="Memberships") * @JoinColumn(name="user_id", referencedColumnName="id", nullable=false) */ public $user; /** + * @var DDC345Group * @OneToOne(targetEntity="DDC345Group", inversedBy="Memberships") * @JoinColumn(name="group_id", referencedColumnName="id", nullable=false) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php index 588c56257c1..0476de418f6 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC353Test.php @@ -140,6 +140,7 @@ public function getFile() class DDC353File { /** + * @var int * @Column(name="file_id", type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php index c407bbff5f5..b9c9a4e9697 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3644Test.php @@ -193,6 +193,7 @@ class DDC3644Address public $id; /** + * @var DDC3644User * @ManyToOne(targetEntity="DDC3644User", inversedBy="addresses") * @JoinColumn(referencedColumnName="hash_id") */ @@ -244,6 +245,7 @@ public function __construct($name) class DDC3644Pet extends DDC3644Animal { /** + * @var DDC3644User * @ManyToOne(targetEntity="DDC3644User", inversedBy="pets") * @JoinColumn(referencedColumnName="hash_id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index 11330aa189e..1ed27cf5b71 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -150,6 +150,7 @@ public function setId(int $value): void class DDC440Client { /** + * @var int * @Column(name="id", type="integer") * @Id * @GeneratedValue(strategy="AUTO") diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php index 14a21dcfb6c..3e53fd25a81 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC448Test.php @@ -52,6 +52,7 @@ class DDC448MainTable private $id; /** + * @var DDC448ConnectedClass * @ManyToOne(targetEntity="DDC448ConnectedClass", cascade={"all"}, fetch="EAGER") * @JoinColumn(name="connectedClassId", referencedColumnName="id", onDelete="CASCADE", nullable=true) */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php index 7036a2123d3..2cec2dd317a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC493Test.php @@ -48,6 +48,7 @@ class DDC493Customer */ public $id; /** + * @var DDC493Contact * @OneToOne(targetEntity="DDC493Contact", cascade={"remove","persist"}) * @JoinColumn(name="contact", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php index 148d8f56577..e8aa9e7ff94 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC513Test.php @@ -56,6 +56,7 @@ class DDC513Item public $id; /** + * @var DDC513Price * @OneToOne(targetEntity="DDC513Price", cascade={"remove","persist"}) * @JoinColumn(name="price", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index ffe4f555528..5c58c82b8f9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -131,6 +131,7 @@ class DDC522Cart public $total; /** + * @var DDC522Customer * @OneToOne(targetEntity="DDC522Customer", inversedBy="cart") * @JoinColumn(name="customer", referencedColumnName="id") */ @@ -152,6 +153,7 @@ class DDC522ForeignKeyTest public $cartId; /** + * @var DDC522Cart * @OneToOne(targetEntity="DDC522Cart") * @JoinColumn(name="cart_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php index 9c705b62fff..50092c480a2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC588Test.php @@ -38,6 +38,7 @@ public function testIssue(): void class DDC588Site { /** + * @var int * @Id * @Column(type="integer", name="site_id") * @GeneratedValue From d76cbd755fb6c856b9d3c71d58f1ad265bee9a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 16 Feb 2021 08:12:36 +0100 Subject: [PATCH 24/27] Manually fix cs --- .../CustomType/CustomIdObjectTypeChild.php | 5 ++- .../Tests/Models/Forum/ForumAdministrator.php | 5 ++- .../Doctrine/Tests/Models/GeoNames/Admin1.php | 5 ++- .../Models/GeoNames/Admin1AlternateName.php | 5 ++- tests/Doctrine/Tests/Models/GeoNames/City.php | 5 ++- .../Tests/Models/GeoNames/Country.php | 5 ++- tests/Doctrine/Tests/Models/Taxi/Car.php | 5 ++- tests/Doctrine/Tests/Models/Taxi/Driver.php | 5 ++- .../Functional/MergeSharedEntitiesTest.php | 21 +++++++++++-- .../ORM/Functional/SchemaTool/DBAL483Test.php | 5 ++- .../SchemaTool/MySqlSchemaToolTest.php | 7 ++++- .../ORM/Functional/Ticket/DDC3303Test.php | 22 ++++++++++--- .../ORM/Functional/Ticket/DDC3785Test.php | 9 ++++-- .../ORM/Functional/Ticket/DDC381Test.php | 2 +- .../ORM/Functional/Ticket/DDC3967Test.php | 4 +-- .../ORM/Functional/Ticket/DDC422Test.php | 4 ++- .../ORM/Functional/Ticket/DDC425Test.php | 8 +++-- .../ORM/Functional/Ticket/DDC440Test.php | 31 ++++++++++++------- .../ORM/Functional/Ticket/DDC444Test.php | 8 +++-- .../ORM/Functional/Ticket/DDC501Test.php | 2 +- .../ORM/Functional/Ticket/DDC512Test.php | 1 + .../ORM/Functional/Ticket/DDC522Test.php | 10 ++++-- .../ORM/Functional/Ticket/DDC531Test.php | 14 +++++++-- .../ORM/Functional/Ticket/DDC5684Test.php | 11 ++++++- 24 files changed, 151 insertions(+), 48 deletions(-) diff --git a/tests/Doctrine/Tests/Models/CustomType/CustomIdObjectTypeChild.php b/tests/Doctrine/Tests/Models/CustomType/CustomIdObjectTypeChild.php index 34c06a6352a..836d16d1a6b 100644 --- a/tests/Doctrine/Tests/Models/CustomType/CustomIdObjectTypeChild.php +++ b/tests/Doctrine/Tests/Models/CustomType/CustomIdObjectTypeChild.php @@ -18,7 +18,10 @@ class CustomIdObjectTypeChild */ public $id; - /** @ManyToOne(targetEntity="Doctrine\Tests\Models\CustomType\CustomIdObjectTypeParent", inversedBy="children") */ + /** + * @var CustomIdObjectTypeParent + * @ManyToOne(targetEntity="Doctrine\Tests\Models\CustomType\CustomIdObjectTypeParent", inversedBy="children") + */ public $parent; public function __construct(CustomIdObject $id, CustomIdObjectTypeParent $parent) diff --git a/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php b/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php index 3e237659c9a..eb3b65a9cc3 100644 --- a/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php +++ b/tests/Doctrine/Tests/Models/Forum/ForumAdministrator.php @@ -9,6 +9,9 @@ */ class ForumAdministrator extends ForumUser { - /** @Column(type="integer", name="access_level") */ + /** + * @var int + * @Column(type="integer", name="access_level") + */ public $accessLevel; } diff --git a/tests/Doctrine/Tests/Models/GeoNames/Admin1.php b/tests/Doctrine/Tests/Models/GeoNames/Admin1.php index 65cc5d0befa..52e3139e3b3 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Admin1.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Admin1.php @@ -33,7 +33,10 @@ class Admin1 */ public $names = []; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ public $name; public function __construct($id, $name, Country $country) diff --git a/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php b/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php index 2611636e24e..0b64cdfd140 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Admin1AlternateName.php @@ -29,7 +29,10 @@ class Admin1AlternateName */ public $admin1; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ public $name; public function __construct($id, $name, Admin1 $admin1) diff --git a/tests/Doctrine/Tests/Models/GeoNames/City.php b/tests/Doctrine/Tests/Models/GeoNames/City.php index aacd056fbf8..41761393c69 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/City.php +++ b/tests/Doctrine/Tests/Models/GeoNames/City.php @@ -36,7 +36,10 @@ class City */ public $admin1; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ public $name; public function __construct($id, $name) diff --git a/tests/Doctrine/Tests/Models/GeoNames/Country.php b/tests/Doctrine/Tests/Models/GeoNames/Country.php index 4ff1cc835b7..08fc873eb02 100644 --- a/tests/Doctrine/Tests/Models/GeoNames/Country.php +++ b/tests/Doctrine/Tests/Models/GeoNames/Country.php @@ -19,7 +19,10 @@ class Country */ public $id; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ public $name; public function __construct($id, $name) diff --git a/tests/Doctrine/Tests/Models/Taxi/Car.php b/tests/Doctrine/Tests/Models/Taxi/Car.php index 50e54f4238c..038427bf3bb 100644 --- a/tests/Doctrine/Tests/Models/Taxi/Car.php +++ b/tests/Doctrine/Tests/Models/Taxi/Car.php @@ -18,7 +18,10 @@ class Car */ private $brand; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ private $model; /** @OneToMany(targetEntity="Ride", mappedBy="car") */ diff --git a/tests/Doctrine/Tests/Models/Taxi/Driver.php b/tests/Doctrine/Tests/Models/Taxi/Driver.php index 312a54330b1..4ab7def2678 100644 --- a/tests/Doctrine/Tests/Models/Taxi/Driver.php +++ b/tests/Doctrine/Tests/Models/Taxi/Driver.php @@ -18,7 +18,10 @@ class Driver */ private $id; - /** @Column(type="string", length=255); */ + /** + * @var string + * @Column(type="string", length=255); + */ private $name; /** @OneToMany(targetEntity="Ride", mappedBy="driver") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php index 70465244a4b..852e29ec5e5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/MergeSharedEntitiesTest.php @@ -110,7 +110,12 @@ public function testMergeInheritedTransientPrivateProperties(): void /** @Entity */ class MSEPicture { - /** @Column(type="integer") @Id @GeneratedValue */ + /** + * @var int + * @Column(type="integer") + * @Id + * @GeneratedValue + */ public $id; /** @@ -129,7 +134,12 @@ class MSEPicture /** @Entity */ class MSEFile { - /** @Column(type="integer") @Id @GeneratedValue(strategy="AUTO") */ + /** + * @var int + * @Column(type="integer") + * @Id + * @GeneratedValue(strategy="AUTO") + */ public $id; } @@ -152,6 +162,11 @@ public function setSession($session): void /** @Entity */ class MSEAdmin extends MSEUser { - /** @Column(type="integer") @Id @GeneratedValue(strategy="NONE") */ + /** + * @var int + * @Column(type="integer") + * @Id + * @GeneratedValue(strategy="NONE") + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php index 7dec236c3c1..18ae6371306 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php @@ -54,7 +54,10 @@ class DBAL483Default */ public $id; - /** @Column(type="integer", options={"default": 0}) */ + /** + * @var int + * @Column(type="integer", options={"default": 0}) + */ public $num; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php index 032835fd281..25c28eed09b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php @@ -109,6 +109,11 @@ public function testGetCreateSchemaSql4(): void */ class MysqlSchemaNamespacedEntity { - /** @Column(type="integer") @Id @GeneratedValue */ + /** + * @var int + * @Column(type="integer") + * @Id + * @GeneratedValue + */ public $id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php index 7a7276ff30a..0dd3f1d7120 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3303Test.php @@ -59,16 +59,25 @@ public function __construct($name, DDC3303Address $address) */ class DDC3303Address { - /** @Column(type="string") @var string */ + /** + * @var string + * @Column(type="string") + */ private $street; - /** @Column(type="integer") @var int */ + /** + * @var int + * @Column(type="integer") + */ private $number; - /** @Column(type="string") @var string */ + /** + * @var string + * @Column(type="string") + */ private $city; - public function __construct($street, $number, $city) + public function __construct(string $street, int $number, string $city) { $this->street = $street; $this->number = $number; @@ -82,7 +91,10 @@ public function __construct($street, $number, $city) */ class DDC3303Employee extends DDC3303Person { - /** @Column(type="string") @var string */ + /** + * @var string + * @Column(type="string") + */ private $company; public function __construct($name, DDC3303Address $address, $company) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php index 63592258946..f6cef2bc136 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3785Test.php @@ -126,15 +126,18 @@ public function __construct($name, $value) /** @Embeddable */ class DDC3785_AssetId { - /** @Column(type = "guid") */ + /** + * @var string + * @Column(type = "guid") + */ private $id; - public function __construct($id) + public function __construct(string $id) { $this->id = $id; } - public function __toString() + public function __toString(): string { return $this->id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php index 115e4b8bb5b..2fa7a74a182 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC381Test.php @@ -60,7 +60,7 @@ class DDC381Entity */ protected $id; - public function getId() + public function getId(): int { return $this->id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3967Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3967Test.php index 8fb691fc694..c66b4b8e61e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3967Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3967Test.php @@ -27,10 +27,10 @@ public function testIdentifierCachedWithProperType(): void $id = $country->getId(); // First time, loaded from database - $this->_em->find(Country::class, "$id"); + $this->_em->find(Country::class, (string) $id); $this->_em->clear(); - $country = $this->_em->find(Country::class, "$id"); + $country = $this->_em->find(Country::class, (string) $id); assert($country instanceof Country); // Identifier type should be integer diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php index 97275200bd4..901c131fdc1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC422Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\PersistentCollection; use Doctrine\Tests\OrmFunctionalTestCase; @@ -70,11 +71,12 @@ class DDC422Guest class DDC422Customer extends DDC422Guest { /** + * @var Collection * @ManyToMany(targetEntity="DDC422Contact", cascade={"persist","remove"}) * @JoinTable(name="ddc422_customers_contacts", * joinColumns={@JoinColumn(name="customer_id", referencedColumnName="id", onDelete="cascade" )}, * inverseJoinColumns={@JoinColumn(name="contact_id", referencedColumnName="id", onDelete="cascade" )} - * ) + * ) */ public $contacts; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php index 09bad77faff..d9c9eebdbfa 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC425Test.php @@ -4,7 +4,8 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; -use DateTime, Doctrine\DBAL\Types\Type; +use DateTime; +use Doctrine\DBAL\Types\Type; use Doctrine\Tests\OrmFunctionalTestCase; class DDC425Test extends OrmFunctionalTestCase @@ -43,6 +44,9 @@ class DDC425Entity */ public $id; - /** @Column(type="datetime") */ + /** + * @var DateTime + * @Column(type="datetime") + */ public $someDatetimeField; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php index 1ed27cf5b71..f8500b53db3 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC440Test.php @@ -4,6 +4,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; +use Doctrine\Common\Collections\Collection; use Doctrine\Tests\OrmFunctionalTestCase; use Exception; @@ -29,12 +30,12 @@ protected function setUp(): void */ public function testOriginalEntityDataEmptyWhenProxyLoadedFromTwoAssociations(): void { - /* The key of the problem is that the first phone is fetched via two association, main_phone and phones. + /* The key of the problem is that the first phone is fetched via two association, mainPhone and phones. * * You will notice that the original_entity_datas are not loaded for the first phone. (They are for the second) * - * In the Client entity definition, if you define the main_phone relation after the phones relation, both assertions pass. - * (for the sake or this test, I defined the main_phone relation before the phones relation) + * In the Client entity definition, if you define the mainPhone relation after the phones relation, both assertions pass. + * (for the sake or this test, I defined the mainPhone relation before the phones relation) * */ @@ -156,18 +157,23 @@ class DDC440Client * @GeneratedValue(strategy="AUTO") */ protected $id; + /** + * @var DDC440Phone * @OneToOne(targetEntity="DDC440Phone", fetch="EAGER") * @JoinColumns({ * @JoinColumn(name="main_phone_id", referencedColumnName="id",onDelete="SET NULL") * }) */ - protected $main_phone; + protected $mainPhone; + /** + * @psalm-var Collection * @OneToMany(targetEntity="DDC440Phone", mappedBy="client", cascade={"persist", "remove"}, fetch="EAGER", indexBy="id") * @OrderBy({"number"="ASC"}) */ protected $phones; + /** * @var string * @Column(name="name", type="string") @@ -178,12 +184,12 @@ public function __construct() { } - public function setName($value): void + public function setName(string $value): void { $this->name = $value; } - public function getName() + public function getName(): string { return $this->name; } @@ -194,22 +200,25 @@ public function addPhone(DDC440Phone $value): void $value->setClient($this, false); } - public function getPhones() + /** + * @psalm-return Collection + */ + public function getPhones(): Collection { return $this->phones; } public function setMainPhone(DDC440Phone $value): void { - $this->main_phone = $value; + $this->mainPhone = $value; } - public function getMainPhone() + public function getMainPhone(): DDC440Phone { - return $this->main_phone; + return $this->mainPhone; } - public function getId() + public function getId(): int { return $this->id; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php index 16edc38289f..ba75bbaf5e2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC444Test.php @@ -6,6 +6,8 @@ use Doctrine\Tests\OrmFunctionalTestCase; +use function sprintf; + class DDC444Test extends OrmFunctionalTestCase { protected function setUp(): void @@ -30,7 +32,7 @@ public function testExplicitPolicy(): void $this->_em->flush(); $this->_em->clear(); - $q = $this->_em->createQuery("SELECT u FROM $classname u"); + $q = $this->_em->createQuery(sprintf('SELECT u FROM %s u', $classname)); $u = $q->getSingleResult(); $this->assertEquals('Initial value', $u->name); @@ -40,7 +42,7 @@ public function testExplicitPolicy(): void $this->_em->flush(); $this->_em->clear(); - $u = $this->_em->createQuery("SELECT u FROM $classname u"); + $u = $this->_em->createQuery(sprintf('SELECT u FROM %s u', $classname)); $u = $q->getSingleResult(); $this->assertEquals('Initial value', $u->name); @@ -50,7 +52,7 @@ public function testExplicitPolicy(): void // Now we however persisted it, and this should have updated our friend $this->_em->flush(); - $q = $this->_em->createQuery("SELECT u FROM $classname u"); + $q = $this->_em->createQuery(sprintf('SELECT u FROM %s u', $classname)); $u = $q->getSingleResult(); $this->assertEquals('Modified value', $u->name); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php index b1c425291ef..b571dc5ed9c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC501Test.php @@ -91,7 +91,7 @@ public function testMergeUnitializedManyToManyAndOneToManyCollections(): void $this->assertHasDeprecationMessages(); } - protected function createAndPersistUser() + protected function createAndPersistUser(): CmsUser { $user = new CmsUser(); $user->name = 'Luka'; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php index 3c2e157e44c..fe323ac675c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC512Test.php @@ -69,6 +69,7 @@ class DDC512Customer * NOTE that we can currently not name the join column the same as the field * (item = item), this currently confuses Doctrine. * + * @var DDC512OfferItem * @OneToOne(targetEntity="DDC512OfferItem", cascade={"remove","persist"}) * @JoinColumn(name="item_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index 5c58c82b8f9..5dfee8d6ea7 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -103,7 +103,10 @@ class DDC522Customer */ public $id; - /** @Column */ + /** + * @var mixed + * @Column + */ public $name; /** @@ -149,7 +152,10 @@ class DDC522ForeignKeyTest */ public $id; - /** @Column(type="integer", name="cart_id", nullable=true) */ + /** + * @var int + * @Column(type="integer", name="cart_id", nullable=true) + */ public $cartId; /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php index 8c55cf51b64..41c83183c88 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC531Test.php @@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Functional\Ticket; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Proxy\Proxy; use Doctrine\Tests\OrmFunctionalTestCase; @@ -60,10 +61,14 @@ class DDC531Item */ public $id; - /** @OneToMany(targetEntity="DDC531Item", mappedBy="parent") */ + /** + * @psalm-var Collection + * @OneToMany(targetEntity="DDC531Item", mappedBy="parent") + */ protected $children; /** + * @var DDC531Item * @ManyToOne(targetEntity="DDC531Item", inversedBy="children") * @JoinColumn(name="parentId", referencedColumnName="id") */ @@ -74,12 +79,15 @@ public function __construct() $this->children = new ArrayCollection(); } - public function getParent() + public function getParent(): DDC531Item { return $this->parent; } - public function getChildren() + /** + * @psalm-return Collection + */ + public function getChildren(): Collection { return $this->children; } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php index c7b1daf9427..ec39f7a4f8a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC5684Test.php @@ -79,11 +79,17 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) return $value->value; } + /** + * {@inheritDoc} + */ public function getName() { return self::class; } + /** + * {@inheritDoc} + */ public function requiresSQLCommentHint(AbstractPlatform $platform) { return true; @@ -92,14 +98,16 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) class DDC5684ObjectId { + /** @var mixed */ public $value; + /** @param mixed $value */ public function __construct($value) { $this->value = $value; } - public function __toString() + public function __toString(): string { return (string) $this->value; } @@ -112,6 +120,7 @@ public function __toString() class DDC5684Object { /** + * @var DDC5684ObjectIdType * @Id * @Column(type=Doctrine\Tests\ORM\Functional\Ticket\DDC5684ObjectIdType::class) * @GeneratedValue(strategy="AUTO") From 4f864bc1784ddd7cc7936478c90a2d077fdfdd36 Mon Sep 17 00:00:00 2001 From: Yosh Date: Tue, 16 Feb 2021 16:12:39 +0100 Subject: [PATCH 25/27] Identifier type is not set when many2many relations are deleted (#8401) * Ensure identifier type is set on deleteJoinTableRecords * Housekeeping: phpcs * Housekeeping: phpcs Co-authored-by: Benjamin Eberlei --- .../Entity/BasicEntityPersister.php | 13 +++++---- .../Entity/JoinedSubclassPersister.php | 3 ++- tests/Doctrine/Tests/Mocks/ConnectionMock.php | 19 +++++++++++++ .../BasicEntityPersisterTypeValueSqlTest.php | 27 +++++++++++++++++++ 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php index 0adc93e77a5..42412adc56f 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php @@ -514,13 +514,12 @@ final protected function updateTable($entity, $quotedTableName, array $updateDat } /** - * @param array $identifier - * - * @return void + * @param array $identifier + * @param string[] $types * * @todo Add check for platform if it supports foreign keys/cascading. */ - protected function deleteJoinTableRecords($identifier) + protected function deleteJoinTableRecords(array $identifier, array $types): void { foreach ($this->class->associationMappings as $mapping) { if ($mapping['type'] !== ClassMetadata::MANY_TO_MANY) { @@ -565,10 +564,10 @@ protected function deleteJoinTableRecords($identifier) $joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->class, $this->platform); - $this->conn->delete($joinTableName, array_combine($keys, $identifier)); + $this->conn->delete($joinTableName, array_combine($keys, $identifier), $types); if ($selfReferential) { - $this->conn->delete($joinTableName, array_combine($otherKeys, $identifier)); + $this->conn->delete($joinTableName, array_combine($otherKeys, $identifier), $types); } } } @@ -585,7 +584,7 @@ public function delete($entity) $id = array_combine($idColumns, $identifier); $types = $this->getClassIdentifiersTypes($class); - $this->deleteJoinTableRecords($identifier); + $this->deleteJoinTableRecords($identifier, $types); return (bool) $this->conn->delete($tableName, $id, $types); } diff --git a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php index 49c47f465d2..c014b9cfdba 100644 --- a/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php +++ b/lib/Doctrine/ORM/Persisters/Entity/JoinedSubclassPersister.php @@ -270,8 +270,9 @@ public function delete($entity) { $identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity); $id = array_combine($this->class->getIdentifierColumnNames(), $identifier); + $types = $this->getClassIdentifiersTypes($this->class); - $this->deleteJoinTableRecords($identifier); + $this->deleteJoinTableRecords($identifier, $types); // If the database platform supports FKs, just // delete the row from the root table. Cascades do the rest. diff --git a/tests/Doctrine/Tests/Mocks/ConnectionMock.php b/tests/Doctrine/Tests/Mocks/ConnectionMock.php index d1660ae3ffc..c78ede33375 100644 --- a/tests/Doctrine/Tests/Mocks/ConnectionMock.php +++ b/tests/Doctrine/Tests/Mocks/ConnectionMock.php @@ -40,6 +40,9 @@ class ConnectionMock extends Connection /** @var array */ private $_executeUpdates = []; + /** @var array */ + private $_deletes = []; + /** * @param array $params */ @@ -77,6 +80,14 @@ public function executeUpdate($query, array $params = [], array $types = []) $this->_executeUpdates[] = ['query' => $query, 'params' => $params, 'types' => $types]; } + /** + * {@inheritdoc} + */ + public function delete($table, array $criteria, array $types = []) + { + $this->_deletes[] = ['table' => $table, 'criteria' => $criteria, 'types' => $types]; + } + /** * {@inheritdoc} */ @@ -160,6 +171,14 @@ public function getExecuteUpdates(): array return $this->_executeUpdates; } + /** + * @return array + */ + public function getDeletes(): array + { + return $this->_deletes; + } + public function reset(): void { $this->_inserts = []; diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index 2daf5bce2ef..ad74be343d2 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -15,6 +15,8 @@ use Doctrine\Tests\OrmTestCase; use ReflectionMethod; +use function array_shift; + class BasicEntityPersisterTypeValueSqlTest extends OrmTestCase { /** @var BasicEntityPersister */ @@ -157,4 +159,29 @@ public function testCountEntities(): void { $this->assertEquals(0, $this->persister->count()); } + + public function testDeleteManyToManyUsesTypeValuesSQL(): void + { + $friend = new CustomTypeParent(); + $parent = new CustomTypeParent(); + $parent->addMyFriend($friend); + + $this->_em->getUnitOfWork()->registerManaged($parent, ['id' => 1], []); + $this->_em->getUnitOfWork()->registerManaged($friend, ['id' => 2], []); + + $this->_persister->delete($parent); + + $deletes = $this->_em->getConnection()->getDeletes(); + + self::assertEquals([ + 'table' => 'customtype_parent_friends', + 'criteria' => ['friend_customtypeparent_id' => 1], + 'types' => ['integer'], + ], array_shift($deletes)); + self::assertEquals([ + 'table' => 'customtype_parent_friends', + 'criteria' => ['customtypeparent_id' => 1], + 'types' => ['integer'], + ], array_shift($deletes)); + } } From 3a9b8fde9b212721c407267776b7070b8b7851a4 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 16 Feb 2021 16:24:19 +0100 Subject: [PATCH 26/27] Housekeeping: Fix cs --- .../Persisters/BasicEntityPersisterTypeValueSqlTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php index ad74be343d2..5642e7df5f9 100644 --- a/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php +++ b/tests/Doctrine/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php @@ -166,12 +166,12 @@ public function testDeleteManyToManyUsesTypeValuesSQL(): void $parent = new CustomTypeParent(); $parent->addMyFriend($friend); - $this->_em->getUnitOfWork()->registerManaged($parent, ['id' => 1], []); - $this->_em->getUnitOfWork()->registerManaged($friend, ['id' => 2], []); + $this->entityManager->getUnitOfWork()->registerManaged($parent, ['id' => 1], []); + $this->entityManager->getUnitOfWork()->registerManaged($friend, ['id' => 2], []); - $this->_persister->delete($parent); + $this->persister->delete($parent); - $deletes = $this->_em->getConnection()->getDeletes(); + $deletes = $this->entityManager->getConnection()->getDeletes(); self::assertEquals([ 'table' => 'customtype_parent_friends', From 30a7c2aa676a219e7e3e1c69b24e7c81e058d981 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 16 Feb 2021 17:52:20 +0100 Subject: [PATCH 27/27] [GH-8410] Fix memory leak in new toIterable and state bug. (#8467) * [GH-8410] Fix memory leak in new toIterable and state bug. The new AbstractQuery::toIterable() had a memory leak that AbstractQuery::iterable() did not have. This leak is now fixed. After fixing the leak, one test failed where the identity map in ObjectHydrator triggered and lead to a notice. Introduced a new AbstractHydrator::cleanupAfterRowIteration() that the ObjectHydrator uses to cleanup the state. * [GH-8413] Bugfix: Iterating with multiple, mixed results When multiple entity results are part of a row, the result handling must be different. In addition mixed results with scalars are broken and now throw an exception as illegal operation. * Housekeeping: phpcs * [GH-8413] Add assertions for entity alias iteration. * [GH-8387] Missing @deprecated on Query::iterate --- lib/Doctrine/ORM/AbstractQuery.php | 8 +++- .../Internal/Hydration/AbstractHydrator.php | 17 +++++-- .../ORM/Internal/Hydration/ObjectHydrator.php | 8 ++++ lib/Doctrine/ORM/Query.php | 2 + lib/Doctrine/ORM/Query/QueryException.php | 5 +++ .../ORM/Functional/AdvancedDqlQueryTest.php | 2 - .../ORM/Functional/QueryIterableTest.php | 4 ++ .../Tests/ORM/Functional/QueryTest.php | 45 +++++++++++++++++++ .../Ticket/GH7496WithToIterableTest.php | 11 +++++ 9 files changed, 96 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 7e54820d01a..53469594720 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -31,6 +31,7 @@ use Doctrine\ORM\Internal\Hydration\IterableResult; use Doctrine\ORM\Mapping\MappingException as ORMMappingException; use Doctrine\ORM\Query\Parameter; +use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\Persistence\Mapping\MappingException; use Traversable; @@ -998,7 +999,12 @@ public function toIterable(iterable $parameters = [], $hydrationMode = null): it $this->setParameters($parameters); } - $rsm = $this->getResultSetMapping(); + $rsm = $this->getResultSetMapping(); + + if ($rsm->isMixed && count($rsm->scalarMappings) > 0) { + throw QueryException::iterateWithMixedResultNotAllowed(); + } + $stmt = $this->_doExecute(); return $this->_em->newHydrator($this->_hydrationMode)->toIterable($stmt, $rsm, $this->_hints); diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index 02fbef3b0e9..e1f27dcb050 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -35,6 +35,7 @@ use function array_map; use function array_merge; +use function count; use function end; use function in_array; use function trigger_error; @@ -165,8 +166,6 @@ public function toIterable(Statement $stmt, ResultSetMapping $resultSetMapping, $this->prepare(); - $result = []; - while (true) { $row = $this->_stmt->fetch(FetchMode::ASSOCIATIVE); @@ -176,9 +175,17 @@ public function toIterable(Statement $stmt, ResultSetMapping $resultSetMapping, break; } + $result = []; + $this->hydrateRowData($row, $result); - yield end($result); + $this->cleanupAfterRowIteration(); + + if (count($result) === 1) { + yield end($result); + } else { + yield $result; + } } } @@ -274,6 +281,10 @@ protected function cleanup() ->removeEventListener([Events::onClear], $this); } + protected function cleanupAfterRowIteration(): void + { + } + /** * Hydrates a single row from the current statement instance. * diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index 03ea08523ac..7bcee57b8df 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -141,6 +141,14 @@ protected function cleanup() $this->_uow->hydrationComplete(); } + protected function cleanupAfterRowIteration(): void + { + $this->identifierMap = + $this->initializedCollections = + $this->existingCollections = + $this->resultPointers = []; + } + /** * {@inheritdoc} */ diff --git a/lib/Doctrine/ORM/Query.php b/lib/Doctrine/ORM/Query.php index a26861da8b8..4029812ef74 100644 --- a/lib/Doctrine/ORM/Query.php +++ b/lib/Doctrine/ORM/Query.php @@ -674,6 +674,8 @@ public function getMaxResults() * Executes the query and returns an IterableResult that can be used to incrementally * iterated over the result. * + * @deprecated + * * @param ArrayCollection|mixed[]|null $parameters The query parameters. * @param string|int $hydrationMode The hydration mode to use. * diff --git a/lib/Doctrine/ORM/Query/QueryException.php b/lib/Doctrine/ORM/Query/QueryException.php index ce59d4f3c5f..cc7bac80cad 100644 --- a/lib/Doctrine/ORM/Query/QueryException.php +++ b/lib/Doctrine/ORM/Query/QueryException.php @@ -227,6 +227,11 @@ public static function iterateWithFetchJoinNotAllowed($assoc) ); } + public static function iterateWithMixedResultNotAllowed(): QueryException + { + return new self('Iterating a query with mixed results (using scalars) is not supported.'); + } + /** * @return QueryException */ diff --git a/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php b/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php index b04dd011769..ad816381dab 100644 --- a/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/AdvancedDqlQueryTest.php @@ -171,8 +171,6 @@ public function testSelectSubselect(): void $this->assertEquals('Caramba', $result[0]['brandName']); $this->_em->clear(); - - IterableTester::assertResultsAreTheSame($query); } public function testInSubselect(): void diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryIterableTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryIterableTest.php index 43a2cedafd8..62b86ae2508 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryIterableTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryIterableTest.php @@ -32,6 +32,8 @@ public function testAlias(): void $users = $query->getResult(); self::assertCount(1, $users); + $this->assertEquals('gblanco', $users[0]['user']->username); + $this->_em->clear(); IterableTester::assertResultsAreTheSame($query); @@ -60,6 +62,8 @@ public function testAliasInnerJoin(): void $users = $query->getResult(); self::assertCount(1, $users); + $this->assertEquals('gblanco', $users[0]['user']->username); + $this->_em->clear(); IterableTester::assertResultsAreTheSame($query); diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index 1355982f6d9..9a5215b5af5 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -301,6 +301,51 @@ public function testIterateResultIterativelyBuildUpUnitOfWork(): void self::assertSame(2, $iteratedCount); } + public function testToIterableWithMultipleSelectElements(): void + { + $author = new CmsUser(); + $author->name = 'Ben'; + $author->username = 'beberlei'; + + $article1 = new CmsArticle(); + $article1->topic = 'Doctrine 2'; + $article1->text = 'This is an introduction to Doctrine 2.'; + $article1->setAuthor($author); + + $article2 = new CmsArticle(); + $article2->topic = 'Symfony 2'; + $article2->text = 'This is an introduction to Symfony 2.'; + $article2->setAuthor($author); + + $this->_em->persist($article1); + $this->_em->persist($article2); + $this->_em->persist($author); + + $this->_em->flush(); + $this->_em->clear(); + + $query = $this->_em->createQuery('select a, u from ' . CmsArticle::class . ' a JOIN ' . CmsUser::class . ' u WITH a.user = u'); + + $result = iterator_to_array($query->toIterable()); + + $this->assertCount(2, $result); + + foreach ($result as $row) { + $this->assertCount(2, $row); + $this->assertInstanceOf(CmsArticle::class, $row[0]); + $this->assertInstanceOf(CmsUser::class, $row[1]); + } + } + + public function testToIterableWithMixedResultIsNotAllowed(): void + { + $this->expectException(QueryException::class); + $this->expectExceptionMessage('Iterating a query with mixed results (using scalars) is not supported.'); + + $query = $this->_em->createQuery('select a, a.topic from ' . CmsArticle::class . ' a'); + $query->toIterable(); + } + public function testIterateResultClearEveryCycle(): void { $article1 = new CmsArticle(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php index a43aa608b7c..ea15e9e9847 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH7496WithToIterableTest.php @@ -41,9 +41,20 @@ public function testNonUniqueObjectHydrationDuringIteration(): void $bs = IterableTester::iterableToArray( $q->toIterable([], AbstractQuery::HYDRATE_OBJECT) ); + $this->assertCount(2, $bs); $this->assertInstanceOf(GH7496EntityB::class, $bs[0]); $this->assertInstanceOf(GH7496EntityB::class, $bs[1]); + $this->assertEquals(1, $bs[0]->id); + $this->assertEquals(1, $bs[1]->id); + + $bs = IterableTester::iterableToArray( + $q->toIterable([], AbstractQuery::HYDRATE_ARRAY) + ); + + $this->assertCount(2, $bs); + $this->assertEquals(1, $bs[0]['id']); + $this->assertEquals(1, $bs[1]['id']); } }