@@ -71,7 +71,7 @@ public static function from($from)
71
71
$ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
72
72
$ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
73
73
$ class ->implements = $ from ->getInterfaceNames ();
74
- $ class ->documents = preg_replace ('#^\s*\* ?#m ' , '' , trim ($ from ->getDocComment (), "/* \r\n\t" ));
74
+ $ class ->documents = $ from -> getDocComment () ? array ( preg_replace ('#^\s*\* ?#m ' , '' , trim ($ from ->getDocComment (), "/* \r\n\t" ))) : array ( );
75
75
$ namespace = $ from ->getNamespaceName ();
76
76
if ($ from ->getParentClass ()) {
77
77
$ class ->extends = $ from ->getParentClass ()->getName ();
@@ -118,7 +118,7 @@ public function __toString()
118
118
119
119
$ properties = array ();
120
120
foreach ($ this ->properties as $ property ) {
121
- $ doc = str_replace ("\n" , "\n * " , implode ("\n" , ( array ) $ property ->getDocuments ()));
121
+ $ doc = str_replace ("\n" , "\n * " , implode ("\n" , $ property ->getDocuments ()));
122
122
$ properties [] = ($ property ->getDocuments () ? (strpos ($ doc , "\n" ) === FALSE ? "/** $ doc */ \n" : "/** \n * $ doc \n */ \n" ) : '' )
123
123
. $ property ->getVisibility () . ($ property ->isStatic () ? ' static ' : '' ) . ' $ ' . $ property ->getName ()
124
124
. ($ property ->value === NULL ? '' : ' = ' . Helpers::dump ($ property ->value ))
@@ -139,7 +139,7 @@ public function __toString()
139
139
}
140
140
141
141
return Strings::normalize (
142
- ($ this ->documents ? str_replace ("\n" , "\n * " , "/** \n" . implode ("\n" , ( array ) $ this ->documents )) . "\n */ \n" : '' )
142
+ ($ this ->documents ? str_replace ("\n" , "\n * " , "/** \n" . implode ("\n" , $ this ->documents )) . "\n */ \n" : '' )
143
143
. ($ this ->abstract ? 'abstract ' : '' )
144
144
. ($ this ->final ? 'final ' : '' )
145
145
. $ this ->type . ' '
0 commit comments