From 68d2a52b429fcbab2e041ae22eed3c15513720be Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 27 Nov 2021 20:53:55 +0100 Subject: [PATCH] Avoid creation of dynamic property in test This test requires a property that is not a subnode -- but it does not need to be dynamic, a declared property works just as well. --- test/PhpParser/NodeAbstractTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/PhpParser/NodeAbstractTest.php b/test/PhpParser/NodeAbstractTest.php index e52479f..5fc23c8 100644 --- a/test/PhpParser/NodeAbstractTest.php +++ b/test/PhpParser/NodeAbstractTest.php @@ -6,11 +6,13 @@ class DummyNode extends NodeAbstract { public $subNode1; public $subNode2; + public $notSubNode; - public function __construct($subNode1, $subNode2, $attributes) { + public function __construct($subNode1, $subNode2, $notSubNode, $attributes) { parent::__construct($attributes); $this->subNode1 = $subNode1; $this->subNode2 = $subNode2; + $this->notSubNode = $notSubNode; } public function getSubNodeNames() : array { @@ -40,8 +42,7 @@ class NodeAbstractTest extends \PHPUnit\Framework\TestCase ], ]; - $node = new DummyNode('value1', 'value2', $attributes); - $node->notSubNode = 'value3'; + $node = new DummyNode('value1', 'value2', 'value3', $attributes); return [ [$attributes, $node], @@ -90,7 +91,7 @@ class NodeAbstractTest extends \PHPUnit\Framework\TestCase } public function testSetDocComment() { - $node = new DummyNode(null, null, []); + $node = new DummyNode(null, null, null, []); // Add doc comment to node without comments $docComment = new Comment\Doc('/** doc */');