Skip to content

Commit a7a9787

Browse files
author
Marco Perone
committed
expose issue #103 with a test
1 parent 346f28f commit a7a9787

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace phpDocumentor\Reflection\NodeVisitor;
1515

1616
use PhpParser\Node\Const_;
17+
use PhpParser\Node\Expr\New_;
1718
use PhpParser\Node\Name;
1819
use PhpParser\Node\Scalar\String_;
1920
use PhpParser\Node\Stmt\Class_;
@@ -77,6 +78,27 @@ public function testDoesNotEnterAnonymousClass()
7778
);
7879
}
7980

81+
/**
82+
* @link https://github.com/phpDocumentor/Reflection/issues/103
83+
* @covers ::enterNode
84+
* @covers ::leaveNode
85+
*/
86+
public function testAnonymousClassDoesNotPopParts()
87+
{
88+
$anonymousClass = new Class_(null);
89+
90+
$new = new New_($anonymousClass);
91+
92+
$namespace = new Namespace_(new Name('ANamespace'), $new);
93+
94+
$this->fixture->enterNode($namespace);
95+
$this->fixture->enterNode($new);
96+
$this->fixture->enterNode($anonymousClass);
97+
$this->fixture->leaveNode($anonymousClass);
98+
$this->fixture->leaveNode($new);
99+
$this->fixture->leaveNode($namespace);
100+
}
101+
80102
/**
81103
* @covers ::enterNode
82104
*/

0 commit comments

Comments
 (0)