@@ -80,7 +80,7 @@ public static function from($from)
80
80
$ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
81
81
$ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
82
82
$ 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 ()) ;
84
84
if ($ from ->getParentClass ()) {
85
85
$ class ->extends = $ from ->getParentClass ()->getName ();
86
86
$ class ->implements = array_diff ($ class ->implements , $ from ->getParentClass ()->getInterfaceNames ());
@@ -118,8 +118,7 @@ public function __toString()
118
118
119
119
$ properties = [];
120
120
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 ())
123
122
. $ property ->getVisibility () . ($ property ->isStatic () ? ' static ' : '' ) . ' $ ' . $ property ->getName ()
124
123
. ($ property ->value === NULL ? '' : ' = ' . Helpers::dump ($ property ->value ))
125
124
. "; \n" ;
@@ -130,7 +129,7 @@ public function __toString()
130
129
};
131
130
132
131
return Strings::normalize (
133
- ($ this ->comment ? str_replace ( "\n" , "\n * " , " /** \n" . $ this -> comment ) . "\n */ \n" : '' )
132
+ Helpers:: formatDocComment ($ this ->comment . "\n" )
134
133
. ($ this ->abstract ? 'abstract ' : '' )
135
134
. ($ this ->final ? 'final ' : '' )
136
135
. $ this ->type . ' '
0 commit comments