File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ protected function parseTags(string $tags): void {
184184 foreach (explode ("\n" , $ tags ) as $ line ) {
185185 if ($ this ->isTagLine ($ line ) || count ($ result ) == 0 ) {
186186 $ result [] = $ line ;
187- } else {
187+ } elseif ( $ line !== '' ) {
188188 $ result [count ($ result ) - 1 ] .= "\n" . $ line ;
189189 }
190190 }
Original file line number Diff line number Diff line change @@ -201,4 +201,20 @@ public function testRemoveTag(): void {
201201 $ this ->assertTrue ($ docblock ->hasTag ('see ' ));
202202 $ this ->assertFalse ($ docblock ->hasTag ('since ' ));
203203 }
204+
205+ public function testDocblockWithBlankLines (): void {
206+ $ text = '/**
207+ * @param string $foo makes a fow
208+ *
209+ * @return bool true on success and false if it fails
210+ */ ' ;
211+ $ docblock = new Docblock ($ text );
212+ $ tags = $ docblock ->getTags ();
213+
214+ $ this ->assertEquals (2 , $ tags ->size ());
215+ $ this ->assertInstanceOf (ParamTag::class, $ tags ->get (0 ));
216+ $ this ->assertEquals ('makes a fow ' , $ tags ->get (0 )->getDescription ());
217+ $ this ->assertInstanceOf (ReturnTag::class, $ tags ->get (1 ));
218+ $ this ->assertEquals ('true on success and false if it fails ' , $ tags ->get (1 )->getDescription ());
219+ }
204220}
You can’t perform that action at this time.
0 commit comments