From 586755b53b7b5a5e6da76d7641fd626c03302375 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Thu, 5 Jan 2023 10:36:04 +0100 Subject: [PATCH] fix undeclared variables --- lib/Doctrine/ODM/PHPCR/DocumentManager.php | 5 +++++ .../PHPCR/Query/Builder/ConstraintChild.php | 10 ++++++++++ .../PHPCR/Functional/CascadePersistTest.php | 2 +- .../PHPCR/Functional/CascadeRefreshTest.php | 2 +- .../PHPCR/Functional/CascadeRemoveTest.php | 2 +- .../Functional/ChangesetCalculationTest.php | 2 +- .../PHPCR/Functional/EventComputingTest.php | 2 +- .../Functional/EventObjectUpdateTest.php | 1 - .../Tests/ODM/PHPCR/Functional/MergeTest.php | 1 - .../ODM/PHPCR/Functional/ReferenceTest.php | 20 +++++++------------ .../ODM/PHPCR/Functional/ReferrerTest.php | 2 -- .../Translation/DocumentManagerTest.php | 2 +- .../ODM/PHPCR/Id/ParentIdGeneratorTest.php | 2 +- tests/phpunit_doctrine_dbal.xml.dist | 1 + 14 files changed, 30 insertions(+), 24 deletions(-) diff --git a/lib/Doctrine/ODM/PHPCR/DocumentManager.php b/lib/Doctrine/ODM/PHPCR/DocumentManager.php index ac095ace6..1ab0cf7fe 100644 --- a/lib/Doctrine/ODM/PHPCR/DocumentManager.php +++ b/lib/Doctrine/ODM/PHPCR/DocumentManager.php @@ -106,6 +106,11 @@ class DocumentManager implements DocumentManagerInterface */ protected $localeChooserStrategy; + /** + * @var ValueConverter + */ + private $valueConverter; + public function __construct(SessionInterface $session, Configuration $config = null, EventManager $evm = null) { $this->session = $session; diff --git a/lib/Doctrine/ODM/PHPCR/Query/Builder/ConstraintChild.php b/lib/Doctrine/ODM/PHPCR/Query/Builder/ConstraintChild.php index 533d60f73..791ad3f6c 100644 --- a/lib/Doctrine/ODM/PHPCR/Query/Builder/ConstraintChild.php +++ b/lib/Doctrine/ODM/PHPCR/Query/Builder/ConstraintChild.php @@ -10,6 +10,16 @@ */ class ConstraintChild extends AbstractLeafNode { + /** + * @var string + */ + private $alias; + + /** + * @var string + */ + private $parentPath; + public function __construct(AbstractNode $parent, $alias, $parentPath) { $this->alias = $alias; diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadePersistTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadePersistTest.php index aea0fc019..c0588edff 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadePersistTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadePersistTest.php @@ -21,7 +21,7 @@ class CascadePersistTest extends PHPCRFunctionalTestCase public function setUp(): void { $this->dm = $this->createDocumentManager([__DIR__]); - $this->node = $this->resetFunctionalNode($this->dm); + $this->resetFunctionalNode($this->dm); $class = $this->dm->getClassMetadata(CmsUser::class); $class->mappings['groups']['cascade'] = ClassMetadata::CASCADE_PERSIST; diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRefreshTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRefreshTest.php index 1e59a52a1..67df05330 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRefreshTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRefreshTest.php @@ -19,7 +19,7 @@ class CascadeRefreshTest extends PHPCRFunctionalTestCase public function setUp(): void { $this->dm = $this->createDocumentManager([__DIR__]); - $this->node = $this->resetFunctionalNode($this->dm); + $this->resetFunctionalNode($this->dm); $class = $this->dm->getClassMetadata(CmsUser::class); $class->mappings['groups']['cascade'] = ClassMetadata::CASCADE_REFRESH; diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRemoveTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRemoveTest.php index 0394c95d1..0f2203761 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRemoveTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/CascadeRemoveTest.php @@ -19,7 +19,7 @@ class CascadeRemoveTest extends PHPCRFunctionalTestCase public function setUp(): void { $this->dm = $this->createDocumentManager([__DIR__]); - $this->node = $this->resetFunctionalNode($this->dm); + $this->resetFunctionalNode($this->dm); $class = $this->dm->getClassMetadata(CmsUser::class); $class->mappings['groups']['cascade'] = ClassMetadata::CASCADE_REMOVE; diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ChangesetCalculationTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ChangesetCalculationTest.php index bd8b9c15b..c0c30f957 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ChangesetCalculationTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ChangesetCalculationTest.php @@ -27,7 +27,7 @@ public function setUp(): void $this->listener = new ChangesetListener(); $this->dm = $this->createDocumentManager(); $this->dm->setLocaleChooserStrategy(new LocaleChooser(['en' => ['fr'], 'fr' => ['en']], 'en')); - $this->node = $this->resetFunctionalNode($this->dm); + $this->resetFunctionalNode($this->dm); } public function testComputeChangeset() diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php index 9e4e1453d..50cbc35a6 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php @@ -149,7 +149,7 @@ public function testComputingBetweenEventsWithTranslation(): void // name has been changed when translation was updated $this->assertEquals('preUpdateTranslation', $user->name); - $this->dm->name = 'neuer Name'; + $user->name = 'neuer Name'; $this->dm->bindTranslation($user, 'de'); $this->dm->flush(); diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventObjectUpdateTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventObjectUpdateTest.php index 4bf2ba054..8825a93cb 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventObjectUpdateTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventObjectUpdateTest.php @@ -24,7 +24,6 @@ public function setUp(): void { $this->listener = new TestEventDocumentChanger2(); $this->dm = $this->createDocumentManager(); - $this->node = $this->resetFunctionalNode($this->dm); } public function testComputingBetweenEvents(): void diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/MergeTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/MergeTest.php index 785627380..1a6f5726c 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/MergeTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/MergeTest.php @@ -138,7 +138,6 @@ public function testMergeUnknownAssignedId(): void { $doc = new CmsArticle(); $doc->id = '/foo'; - $doc->name = 'Foo'; $mergedDoc = $this->dm->merge($doc); diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferenceTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferenceTest.php index ca90f0ab3..d897dc3ca 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferenceTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferenceTest.php @@ -797,7 +797,6 @@ public function testReferenceMany(): void { $refManyTestObj = new RefManyTestObj(); $refManyTestObj->id = '/functional/refManyTestObj'; - $refManyTestObj->name = 'referrer'; $max = 5; @@ -826,7 +825,6 @@ public function testReferenceManyPath(): void { $refManyTestObj = new RefManyTestObjPathStrategy(); $refManyTestObj->id = '/functional/refManyTestObjWP'; - $refManyTestObj->name = 'referrer'; $max = 5; @@ -855,7 +853,6 @@ public function testNoReferenceInitOnFlush(): void { $refManyTestObj = new RefManyTestObj(); $refManyTestObj->id = '/functional/refManyTestObj'; - $refManyTestObj->name = 'referrer'; $max = 5; @@ -932,7 +929,6 @@ public function testModificationAfterPersist(): void $referenced->id = '/functional/refRefTestObj'; $this->dm->persist($referrer); - $referrer->name = 'Referrer'; $referrer->reference = $referenced; $referenced->name = 'Referenced'; @@ -997,7 +993,6 @@ public function testCreateCascade(): void $refCascadeTestObj = new RefCascadeTestObj(); $refCascadeTestObj->id = '/functional/refCascadeTestObj'; - $refCascadeTestObj->name = 'refCascadeTestObj'; $referrer->reference = $refCascadeTestObj; @@ -1335,7 +1330,6 @@ public function testCascadeRemoveByCollection(): void for ($i = 0; $i < $max; ++$i) { $newReferrerTestObj = new ReferenceRefTestObj(); $newReferrerTestObj->id = "/functional/referenceRefTestObj$i"; - $newReferrerTestObj->name = "referrerTestObj$i"; $referrerRefManyTestObj->reference[] = $newReferrerTestObj; } @@ -1343,17 +1337,17 @@ public function testCascadeRemoveByCollection(): void $this->dm->flush(); $this->dm->clear(); - $referrered = $this->dm->find(null, '/functional/referenceTestObj'); - $this->assertCount($max, $referrered->reference); - $referrered->reference->remove(0); - $referrered->reference->remove(3); - $this->assertCount($max - 2, $referrered->reference); + $referred = $this->dm->find(null, '/functional/referenceTestObj'); + $this->assertCount($max, $referred->reference); + $referred->reference->remove(0); + $referred->reference->remove(3); + $this->assertCount($max - 2, $referred->reference); $this->dm->flush(); $this->dm->clear(); - $referrered = $this->dm->find(null, '/functional/referenceTestObj'); - $this->assertCount($max - 2, $referrered->reference); + $referred = $this->dm->find(null, '/functional/referenceTestObj'); + $this->assertCount($max - 2, $referred->reference); } } diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferrerTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferrerTest.php index 1895bc06c..ae630683b 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferrerTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/ReferrerTest.php @@ -48,7 +48,6 @@ public function testCreate(): void $referrerTestObj->id = '/functional/referrerTestObj'; $referrerTestObj->name = 'referrer'; $referrerRefTestObj->id = '/functional/referrerRefTestObj'; - $referrerRefTestObj->name = 'referenced'; $referrerTestObj->reference = $referrerRefTestObj; @@ -615,7 +614,6 @@ public function testCascadeRemoveByCollection(): void for ($i = 0; $i < $max; ++$i) { $newReferrerTestObj = new ReferrerTestObj2(); $newReferrerTestObj->id = "/functional/referrerTestObj$i"; - $newReferrerTestObj->name = "referrerTestObj$i"; $newReferrerTestObj->reference = $referrerRefManyTestObj; $this->dm->persist($newReferrerTestObj); } diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/DocumentManagerTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/DocumentManagerTest.php index 81426e555..68bb00ce6 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/DocumentManagerTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/Translation/DocumentManagerTest.php @@ -688,7 +688,7 @@ public function testFindTranslationNonPersisted(): void { $a = new Article(); $a->id = '/functional/'.$this->testNodeName; - $a->title = 'Hello'; + $a->topic = 'Hello'; $this->dm->persist($a); $translations = [ diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Id/ParentIdGeneratorTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Id/ParentIdGeneratorTest.php index 5487a7db7..451c85197 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Id/ParentIdGeneratorTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Id/ParentIdGeneratorTest.php @@ -132,7 +132,7 @@ class ParentClassMetadataProxy extends ClassMetadata protected $_nodename; - protected $_id; + private $_identifier; public function __construct($parent, $nodename, $identifier, $mockField = null) { diff --git a/tests/phpunit_doctrine_dbal.xml.dist b/tests/phpunit_doctrine_dbal.xml.dist index 08ed164fb..7bc61de28 100644 --- a/tests/phpunit_doctrine_dbal.xml.dist +++ b/tests/phpunit_doctrine_dbal.xml.dist @@ -16,6 +16,7 @@ +