Skip to content

Commit

Permalink
Avoid creation of dynamic property in test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Nov 27, 2021
1 parent 63f8699 commit 68d2a52
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/PhpParser/NodeAbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -40,8 +42,7 @@ public function provideNodes() {
],
];

$node = new DummyNode('value1', 'value2', $attributes);
$node->notSubNode = 'value3';
$node = new DummyNode('value1', 'value2', 'value3', $attributes);

return [
[$attributes, $node],
Expand Down Expand Up @@ -90,7 +91,7 @@ public function testGetDocComment(array $attributes, Node $node) {
}

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 */');
Expand Down

0 comments on commit 68d2a52

Please sign in to comment.