From b1d60daf9553920a76c57003c575c2dcc695fe0c 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] 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 | 49 ++--- .../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, 754 insertions(+), 229 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..cf9e37887c2 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']); @@ -405,7 +406,7 @@ public function __destruct() // $this->_deleteDirectory(__DIR__ . '/export/'.$this->_getType()); } - protected function _deleteDirectory($path) + protected function deleteDirectory(string $path): bool { if (is_file($path)) { return unlink($path); @@ -414,7 +415,7 @@ protected function _deleteDirectory($path) if (is_array($files)) { foreach ($files as $file) { - $this->_deleteDirectory($file); + $this->deleteDirectory($file); } } 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