@@ -7623,6 +7623,14 @@ public function testLinesAndIndexes(string $phpDoc, array $childrenLines): void
76237623 $ this ->assertSame ($ childrenLines [$ i ][2 ], $ child ->getAttribute (Attribute::START_INDEX ));
76247624 $ this ->assertSame ($ childrenLines [$ i ][3 ], $ child ->getAttribute (Attribute::END_INDEX ));
76257625 }
7626+
7627+ $ serialized = var_export ($ phpDocNode , true );
7628+ $ readData = eval ('return ' . $ serialized . '; ' );
7629+ $ this ->assertEquals ($ phpDocNode , $ readData );
7630+
7631+ $ serialized = var_export ($ phpDocNode , true );
7632+ $ readData = eval ('return ' . $ serialized . '; ' );
7633+ $ this ->assertEquals ($ phpDocNode , $ readData );
76267634 }
76277635
76287636 /**
@@ -7823,14 +7831,20 @@ public function testVerifyAttributes(string $label, string $input): void
78237831
78247832 $ visitor = new NodeCollectingVisitor ();
78257833 $ traverser = new NodeTraverser ([$ visitor ]);
7826- $ traverser ->traverse ([$ phpDocParser ->parse ($ tokens )]);
7834+
7835+ $ phpDocNode = $ phpDocParser ->parse ($ tokens );
7836+ $ traverser ->traverse ([$ phpDocNode ]);
78277837
78287838 foreach ($ visitor ->nodes as $ node ) {
78297839 $ this ->assertNotNull ($ node ->getAttribute (Attribute::START_LINE ), sprintf ('%s: %s ' , $ label , $ node ));
78307840 $ this ->assertNotNull ($ node ->getAttribute (Attribute::END_LINE ), sprintf ('%s: %s ' , $ label , $ node ));
78317841 $ this ->assertNotNull ($ node ->getAttribute (Attribute::START_INDEX ), sprintf ('%s: %s ' , $ label , $ node ));
78327842 $ this ->assertNotNull ($ node ->getAttribute (Attribute::END_INDEX ), sprintf ('%s: %s ' , $ label , $ node ));
78337843 }
7844+
7845+ $ serialized = var_export ($ phpDocNode , true );
7846+ $ readData = eval ('return ' . $ serialized . '; ' );
7847+ $ this ->assertEquals ($ phpDocNode , $ readData );
78347848 }
78357849
78367850 /**
@@ -7846,7 +7860,9 @@ public function testDoctrine(
78467860 {
78477861 $ parser = new DocParser ();
78487862 $ parser ->addNamespace ('PHPStan\PhpDocParser\Parser\Doctrine ' );
7849- $ this ->assertEquals ($ expectedAnnotations , $ parser ->parse ($ input , $ label ), $ label );
7863+
7864+ $ phpDocNode = $ parser ->parse ($ input , $ label );
7865+ $ this ->assertEquals ($ expectedAnnotations , $ phpDocNode , $ label );
78507866 }
78517867
78527868 /**
0 commit comments