@@ -36,6 +36,9 @@ class Serializer
3636    /** @var int|null The max length of a line. */ 
3737    protected  $ lineLengthnull ;
3838
39+     /** @var bool Separate tag groups. */ 
40+     protected  $ separateTagsfalse ;
41+ 
3942    /** 
4043     * Create a Serializer instance. 
4144     * 
@@ -45,17 +48,20 @@ class Serializer
4548     * @param bool     $indentFirstLine Whether to indent the first line. 
4649     * @param int|null $lineLength      The max length of a line or NULL to 
4750     *     disable line wrapping. 
51+      * @param bool     $separateTags    Separate tag groups. 
4852     */ 
4953    public  function  __construct (
5054        $ indent0 ,
5155        $ indentString'  ' ,
5256        $ indentFirstLinetrue ,
53-         $ lineLengthnull 
57+         $ lineLengthnull ,
58+         $ separateTagsfalse 
5459    ) {
5560        $ this setIndentationString ($ indentString
5661        $ this setIndent ($ indent
5762        $ this setIsFirstLineIndented ($ indentFirstLine
5863        $ this setLineLength ($ lineLength
64+         $ this setSeparateTags ($ separateTags
5965    }
6066
6167    /** 
@@ -158,6 +164,29 @@ public function getLineLength()
158164        return  $ this lineLength ;
159165    }
160166
167+     /** 
168+      * Sets whether there should be an empty line between tag groups. 
169+      * 
170+      * @param bool $separateTags The new value for this setting. 
171+      * 
172+      * @return $this This serializer object. 
173+      */ 
174+     public  function  setSeparateTags ($ separateTags
175+     {
176+         $ this separateTags  = (bool )$ separateTags
177+         return  $ this 
178+     }
179+ 
180+     /** 
181+      * Gets whether there should be an empty line between tag groups. 
182+      * 
183+      * @return bool Whether there should be an empty line between tag groups. 
184+      */ 
185+     public  function  getSeparateTags ()
186+     {
187+         return  $ this separateTags ;
188+     }
189+ 
161190    /** 
162191     * Generate a DocBlock comment. 
163192     * 
@@ -180,15 +209,23 @@ public function getDocComment(DocBlock $docblock)
180209
181210        $ comment"{$ firstIndent/** \n{$ indent *  {$ text$ indent * \n" ;
182211
212+         $ tagsarray_values ($ docblockgetTags ());
213+ 
183214        /** @var Tag $tag */ 
184-         foreach  ($ docblockgetTags () as  $ tag
215+         foreach  ($ tagsas  $ key$ tag
216+             $ nextTagisset ($ tags$ key1 ]) ? $ tags$ key1 ] : null ;
217+ 
185218            $ tagTextstring ) $ tag
186219            if  ($ this lineLength ) {
187220                $ tagTextwordwrap ($ tagText$ wrapLength
188221            }
189222            $ tagTextstr_replace ("\n" , "\n{$ indent *  " , $ tagText
190223
191224            $ comment"{$ indent *  {$ tagText ;
225+ 
226+             if  ($ this separateTags  && $ nextTagnull  && ! $ taginSameGroup ($ nextTag
227+                 $ comment"{$ indent * \n" ;
228+             }
192229        }
193230
194231        $ comment$ indent' */ ' ;
0 commit comments