@@ -80,7 +80,7 @@ public static function from($from)
8080 $ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
8181 $ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
8282 $ class ->implements = $ from ->getInterfaceNames ();
83- $ class ->comment = $ from -> getDocComment () ? preg_replace ( ' #^\s*\* ?#m ' , '' , trim ( $ from ->getDocComment (), " /* \r\n\t" )) : NULL ;
83+ $ class ->comment = Helpers:: unformatDocComment ( $ from ->getDocComment ()) ;
8484 if ($ from ->getParentClass ()) {
8585 $ class ->extends = $ from ->getParentClass ()->getName ();
8686 $ class ->implements = array_diff ($ class ->implements , $ from ->getParentClass ()->getInterfaceNames ());
@@ -118,8 +118,7 @@ public function __toString()
118118
119119 $ properties = [];
120120 foreach ($ this ->properties as $ property ) {
121- $ doc = str_replace ("\n" , "\n * " , $ property ->getComment ());
122- $ properties [] = ($ doc ? (strpos ($ doc , "\n" ) === FALSE ? "/** $ doc */ \n" : "/** \n * $ doc \n */ \n" ) : '' )
121+ $ properties [] = Helpers::formatDocComment ($ property ->getComment ())
123122 . $ property ->getVisibility () . ($ property ->isStatic () ? ' static ' : '' ) . ' $ ' . $ property ->getName ()
124123 . ($ property ->value === NULL ? '' : ' = ' . Helpers::dump ($ property ->value ))
125124 . "; \n" ;
@@ -130,7 +129,7 @@ public function __toString()
130129 };
131130
132131 return Strings::normalize (
133- ($ this ->comment ? str_replace ( "\n" , "\n * " , " /** \n" . $ this -> comment ) . "\n */ \n" : '' )
132+ Helpers:: formatDocComment ($ this ->comment . "\n" )
134133 . ($ this ->abstract ? 'abstract ' : '' )
135134 . ($ this ->final ? 'final ' : '' )
136135 . $ this ->type . ' '
0 commit comments