create(ParserFactory::PREFER_PHP7)->parse( 'addVisitor(new ParentConnectingVisitor); $ast = $traverser->traverse($ast); $node = (new NodeFinder)->findFirstInstanceof($ast, ClassMethod::class); $this->assertSame('C', $node->getAttribute('parent')->name->toString()); } }