From f19eecc2be549156aa8c02e57a113a3d6e96bce7 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 26 Apr 2022 10:27:20 +0200 Subject: [PATCH] Remove dynamic property declarations --- tests/Doctrine/Tests/Mocks/ConnectionMock.php | 3 --- .../Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php | 2 +- tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php | 2 -- .../Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php | 7 ------- .../Tests/ORM/Functional/SchemaTool/DBAL483Test.php | 3 +++ .../Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php | 6 ++++++ .../Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php | 4 ---- .../Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php | 3 --- .../Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php | 1 - .../Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php | 3 --- tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php | 5 ++--- tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php | 1 - .../Tests/ORM/Functional/Ticket/Ticket2481Test.php | 2 -- .../Tests/ORM/Mapping/Symfony/AbstractDriverTest.php | 3 +++ tests/Doctrine/Tests/ORM/UnitOfWorkTest.php | 8 ++++---- 15 files changed, 19 insertions(+), 34 deletions(-) diff --git a/tests/Doctrine/Tests/Mocks/ConnectionMock.php b/tests/Doctrine/Tests/Mocks/ConnectionMock.php index f86f2dabab..83a606bac3 100644 --- a/tests/Doctrine/Tests/Mocks/ConnectionMock.php +++ b/tests/Doctrine/Tests/Mocks/ConnectionMock.php @@ -51,9 +51,6 @@ public function __construct(array $params = [], ?Driver $driver = null, ?Configu $this->_platformMock = new DatabasePlatformMock(); parent::__construct($params, $driver ?? new DriverMock(), $config, $eventManager); - - // Override possible assignment of platform to database platform mock - $this->_platform = $this->_platformMock; } public function getDatabase(): string diff --git a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php index a7bd516bdf..8e61f5fb70 100644 --- a/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/BasicFunctionalTest.php @@ -1209,7 +1209,7 @@ public function testFlushSingleAndNoCascade(): void $article1 = new CmsArticle(); $article1->topic = 'Foo'; $article1->text = 'Foo Text'; - $article1->author = $user; + $article1->user = $user; $user->articles[] = $article1; $this->expectException(InvalidArgumentException::class); diff --git a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php index 4629d6a621..c9fd63344c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php @@ -23,8 +23,6 @@ protected function setUp(): void { $this->useModelSet('cms'); parent::setUp(); - - $this->handles = []; } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php index 2a852c34ee..604c432b2a 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php @@ -5,7 +5,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Common\Util\ClassUtils; -use Doctrine\ORM\Proxy\ProxyFactory; use Doctrine\Persistence\Proxy; use Doctrine\Tests\Models\Company\CompanyAuction; use Doctrine\Tests\Models\ECommerce\ECommerceProduct; @@ -31,12 +30,6 @@ protected function setUp(): void $this->useModelSet('ecommerce'); $this->useModelSet('company'); parent::setUp(); - $this->_factory = new ProxyFactory( - $this->_em, - __DIR__ . '/../../Proxies', - 'Doctrine\Tests\Proxies', - true - ); } public function createProduct(): int diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php index 58795181f1..908ca79029 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DBAL483Test.php @@ -16,6 +16,9 @@ class DBAL483Test extends OrmFunctionalTestCase { + /** @var Tools\SchemaTool */ + private $schemaTool; + protected function setUp(): void { parent::setUp(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php index a856df3935..9ea3d88346 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php @@ -26,6 +26,12 @@ */ class DDC1163Test extends OrmFunctionalTestCase { + /** @var int|null */ + private $productId; + + /** @var int|null */ + private $proxyHolderId; + protected function setUp(): void { parent::setUp(); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php index e9e9b108f3..fb8fa3b1a9 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php @@ -38,16 +38,12 @@ public function testIssue(): void $account = new DDC1193Account(); $person->account = $account; - $person->company = $company; - $company->member = $person; $this->_em->persist($company); - $this->_em->flush(); $companyId = $company->id; - $accountId = $account->id; $this->_em->clear(); $company = $this->_em->find(get_class($company), $companyId); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php index cbea3508ee..1fa7f783dd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php @@ -90,17 +90,14 @@ public function loadFixture(): void $user1 = new Models\Legacy\LegacyUser(); $user1->username = 'beberlei'; $user1->name = 'Benjamin'; - $user1->_status = 'active'; $user2 = new Models\Legacy\LegacyUser(); $user2->username = 'jwage'; $user2->name = 'Jonathan'; - $user2->_status = 'active'; $user3 = new Models\Legacy\LegacyUser(); $user3->username = 'romanb'; $user3->name = 'Roman'; - $user3->_status = 'active'; $this->_em->persist($user1); $this->_em->persist($user2); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php index 8ee1d7b711..678783188d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php @@ -25,7 +25,6 @@ protected function setUp(): void $user = new User(); $user->name = 'FabioBatSilva'; - $user->email = 'fabio.bat.silva@gmail.com'; $user->groups[] = new Group('G 1'); $user->groups[] = new Group('G 2'); $this->user = $user; diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php index 0af5d16188..dab5509432 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php @@ -60,17 +60,14 @@ public function loadFixture(): void $user1 = new LegacyUser(); $user1->username = 'FabioBatSilva'; $user1->name = 'Fabio B. Silva'; - $user1->_status = 'active'; $user2 = new LegacyUser(); $user2->username = 'doctrinebot'; $user2->name = 'Doctrine Bot'; - $user2->_status = 'active'; $user3 = new LegacyUser(); $user3->username = 'test'; $user3->name = 'Tester'; - $user3->_status = 'active'; $this->_em->persist($user1); $this->_em->persist($user2); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php index 769bcfc701..8fb713ecb4 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php @@ -77,7 +77,6 @@ public function testJoinColumnWithSameNameAsAssociationField(): void public function testJoinColumnWithNullSameNameAssociationField(): void { $fkCust = new DDC522ForeignKeyTest(); - $fkCust->name = 'name'; $fkCust->cart = null; $this->_em->persist($fkCust); @@ -153,13 +152,13 @@ class DDC522ForeignKeyTest public $id; /** - * @var int + * @var int|null * @Column(type="integer", name="cart_id", nullable=true) */ public $cartId; /** - * @var DDC522Cart + * @var DDC522Cart|null * @OneToOne(targetEntity="DDC522Cart") * @JoinColumn(name="cart_id", referencedColumnName="id") */ diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php index 03ed9d6f08..52f0cf6c55 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php @@ -135,7 +135,6 @@ class Lemma public function __construct() { - $this->types = new ArrayCollection(); $this->relations = new ArrayCollection(); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php index 025fb03881..8fb3b0c245 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php @@ -20,8 +20,6 @@ protected function setUp(): void $this->_schemaTool->createSchema([ $this->_em->getClassMetadata(Ticket2481Product::class), ]); - - $this->_conn = $this->_em->getConnection(); } public function testEmptyInsert(): void diff --git a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php index cfc5ab1a91..774cd80d48 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php @@ -21,6 +21,9 @@ */ abstract class AbstractDriverTest extends TestCase { + /** @var string */ + private $dir; + public function testFindMappingFile(): void { $driver = $this->getDriver( diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 26baa20823..da738141da 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -734,8 +734,8 @@ public function testNewAssociatedEntityPersistenceOfNewEntitiesThroughCascadedAs // the cascading association not set. Having the "cascading path" involve // a non-new object is important to show that the ORM should be considering // cascades across entity changesets in subsequent flushes. - $cascading->cascaded = $cascadePersisted; - $nonCascading->cascaded = $cascadePersisted; + $cascading->cascaded = $cascadePersisted; + $nonCascading->nonCascaded = $cascadePersisted; $this->_unitOfWork->persist($cascading); $this->_unitOfWork->persist($nonCascading); @@ -1115,7 +1115,7 @@ class EntityWithCascadingAssociation private $id; /** - * @var CascadePersistedEntity + * @var CascadePersistedEntity|null * @ManyToOne(targetEntity=CascadePersistedEntity::class, cascade={"persist"}) */ public $cascaded; @@ -1138,7 +1138,7 @@ class EntityWithNonCascadingAssociation private $id; /** - * @var CascadePersistedEntity + * @var CascadePersistedEntity|null * @ManyToOne(targetEntity=CascadePersistedEntity::class) */ public $nonCascaded;