Skip to content

Commit

Permalink
Remove dynamic property declarations (#9683)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Apr 26, 2022
1 parent 534ed9c commit d9508e9
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 34 deletions.
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/Mocks/ConnectionMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Locking/LockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ protected function setUp(): void
{
$this->useModelSet('cms');
parent::setUp();

$this->handles = [];
}

/**
Expand Down
7 changes: 0 additions & 7 deletions tests/Doctrine/Tests/ORM/Functional/ReferenceProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

class DBAL483Test extends OrmFunctionalTestCase
{
/** @var Tools\SchemaTool */
private $schemaTool;

protected function setUp(): void
{
parent::setUp();
Expand Down
6 changes: 6 additions & 0 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1163Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
*/
class DDC1163Test extends OrmFunctionalTestCase
{
/** @var int|null */
private $productId;

/** @var int|null */
private $proxyHolderId;

protected function setUp(): void
{
parent::setUp();
Expand Down
4 changes: 0 additions & 4 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1193Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1885Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ protected function setUp(): void

$user = new User();
$user->name = 'FabioBatSilva';
$user->email = '[email protected]';
$user->groups[] = new Group('G 1');
$user->groups[] = new Group('G 2');
$this->user = $user;
Expand Down
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2519Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC522Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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")
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC69Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class Lemma

public function __construct()
{
$this->types = new ArrayCollection();
$this->relations = new ArrayCollection();
}

Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket2481Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
abstract class AbstractDriverTest extends TestCase
{
/** @var string */
private $dir;

public function testFindMappingFile(): void
{
$driver = $this->getDriver(
Expand Down
8 changes: 4 additions & 4 deletions tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1115,7 +1115,7 @@ class EntityWithCascadingAssociation
private $id;

/**
* @var CascadePersistedEntity
* @var CascadePersistedEntity|null
* @ManyToOne(targetEntity=CascadePersistedEntity::class, cascade={"persist"})
*/
public $cascaded;
Expand All @@ -1138,7 +1138,7 @@ class EntityWithNonCascadingAssociation
private $id;

/**
* @var CascadePersistedEntity
* @var CascadePersistedEntity|null
* @ManyToOne(targetEntity=CascadePersistedEntity::class)
*/
public $nonCascaded;
Expand Down

0 comments on commit d9508e9

Please sign in to comment.