@@ -6682,4 +6682,103 @@ public function testDoctrine(
66826682 $ this ->assertEquals ($ expectedAnnotations , $ parser ->parse ($ input , $ label ), $ label );
66836683 }
66846684
6685+ /**
6686+ * @return iterable<array{string, PhpDocNode}>
6687+ */
6688+ public function dataTextBetweenTagsBelongsToDescription (): iterable
6689+ {
6690+ yield [
6691+ '/** ' . PHP_EOL .
6692+ ' * Real description ' . PHP_EOL .
6693+ ' * @param int $a ' . PHP_EOL .
6694+ ' * paramA description ' . PHP_EOL .
6695+ ' * @param int $b ' . PHP_EOL .
6696+ ' * paramB description ' . PHP_EOL .
6697+ ' */ ' ,
6698+ new PhpDocNode ([
6699+ new PhpDocTextNode ('Real description ' ),
6700+ new PhpDocTagNode ('@param ' , new ParamTagValueNode (new IdentifierTypeNode ('int ' ), false , '$a ' , PHP_EOL . ' paramA description ' )),
6701+ new PhpDocTagNode ('@param ' , new ParamTagValueNode (new IdentifierTypeNode ('int ' ), false , '$b ' , PHP_EOL . ' paramB description ' )),
6702+ ]),
6703+ ];
6704+
6705+ yield [
6706+ '/** ' . PHP_EOL .
6707+ ' * Real description ' . PHP_EOL .
6708+ ' * @param int $a aaaa ' . PHP_EOL .
6709+ ' * bbbb ' . PHP_EOL .
6710+ ' * ' . PHP_EOL .
6711+ ' * ccc ' . PHP_EOL .
6712+ ' */ ' ,
6713+ new PhpDocNode ([
6714+ new PhpDocTextNode ('Real description ' ),
6715+ new PhpDocTagNode ('@param ' , new ParamTagValueNode (new IdentifierTypeNode ('int ' ), false , '$a ' , 'aaaa ' . PHP_EOL . ' bbbb ' . PHP_EOL . PHP_EOL . 'ccc ' )),
6716+ ]),
6717+ ];
6718+
6719+ yield [
6720+ '/** ' . PHP_EOL .
6721+ ' * Real description ' . PHP_EOL .
6722+ ' * @ORM\Column() ' . PHP_EOL .
6723+ ' * bbbb ' . PHP_EOL .
6724+ ' * ' . PHP_EOL .
6725+ ' * ccc ' . PHP_EOL .
6726+ ' */ ' ,
6727+ new PhpDocNode ([
6728+ new PhpDocTextNode ('Real description ' ),
6729+ new PhpDocTagNode ('@ORM\Column ' , new DoctrineTagValueNode (new DoctrineAnnotation ('@ORM\Column ' , []), PHP_EOL . ' bbbb ' . PHP_EOL . PHP_EOL . 'ccc ' )),
6730+ ]),
6731+ ];
6732+
6733+ yield [
6734+ '/** ' . PHP_EOL .
6735+ ' * Real description ' . PHP_EOL .
6736+ ' * @ORM\Column() aaaa ' . PHP_EOL .
6737+ ' * bbbb ' . PHP_EOL .
6738+ ' * ' . PHP_EOL .
6739+ ' * ccc ' . PHP_EOL .
6740+ ' */ ' ,
6741+ new PhpDocNode ([
6742+ new PhpDocTextNode ('Real description ' ),
6743+ new PhpDocTagNode ('@ORM\Column ' , new DoctrineTagValueNode (new DoctrineAnnotation ('@ORM\Column ' , []), 'aaaa ' . PHP_EOL . ' bbbb ' . PHP_EOL . PHP_EOL . 'ccc ' )),
6744+ ]),
6745+ ];
6746+
6747+ yield [
6748+ '/** ' . PHP_EOL .
6749+ ' * Real description ' . PHP_EOL .
6750+ ' * @ORM\Column() aaaa ' . PHP_EOL .
6751+ ' * bbbb ' . PHP_EOL .
6752+ ' * ' . PHP_EOL .
6753+ ' * ccc ' . PHP_EOL .
6754+ ' * @param int $b ' . PHP_EOL .
6755+ ' */ ' ,
6756+ new PhpDocNode ([
6757+ new PhpDocTextNode ('Real description ' ),
6758+ new PhpDocTagNode ('@ORM\Column ' , new DoctrineTagValueNode (new DoctrineAnnotation ('@ORM\Column ' , []), 'aaaa ' . PHP_EOL . ' bbbb ' . PHP_EOL . PHP_EOL . 'ccc ' )),
6759+ new PhpDocTagNode ('@param ' , new ParamTagValueNode (new IdentifierTypeNode ('int ' ), false , '$b ' , '' )),
6760+ ]),
6761+ ];
6762+ }
6763+
6764+ /**
6765+ * @dataProvider dataTextBetweenTagsBelongsToDescription
6766+ */
6767+ public function testTextBetweenTagsBelongsToDescription (
6768+ string $ input ,
6769+ PhpDocNode $ expectedPhpDocNode
6770+ ): void
6771+ {
6772+ $ constExprParser = new ConstExprParser ();
6773+ $ typeParser = new TypeParser ($ constExprParser );
6774+ $ phpDocParser = new PhpDocParser ($ typeParser , $ constExprParser , true , true , [], true , true );
6775+
6776+ $ tokens = new TokenIterator ($ this ->lexer ->tokenize ($ input ));
6777+ $ actualPhpDocNode = $ phpDocParser ->parse ($ tokens );
6778+
6779+ $ this ->assertEquals ($ expectedPhpDocNode , $ actualPhpDocNode );
6780+ $ this ->assertSame ((string ) $ expectedPhpDocNode , (string ) $ actualPhpDocNode );
6781+ $ this ->assertSame (Lexer::TOKEN_END , $ tokens ->currentTokenType ());
6782+ }
6783+
66856784}
0 commit comments