@@ -71,7 +71,7 @@ public static function from($from)
7171 $ class ->final = $ from ->isFinal () && $ class ->type === 'class ' ;
7272 $ class ->abstract = $ from ->isAbstract () && $ class ->type === 'class ' ;
7373 $ 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 ( );
7575 $ namespace = $ from ->getNamespaceName ();
7676 if ($ from ->getParentClass ()) {
7777 $ class ->extends = $ from ->getParentClass ()->getName ();
@@ -118,7 +118,7 @@ public function __toString()
118118
119119 $ properties = array ();
120120 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 ()));
122122 $ properties [] = ($ property ->getDocuments () ? (strpos ($ doc , "\n" ) === FALSE ? "/** $ doc */ \n" : "/** \n * $ doc \n */ \n" ) : '' )
123123 . $ property ->getVisibility () . ($ property ->isStatic () ? ' static ' : '' ) . ' $ ' . $ property ->getName ()
124124 . ($ property ->value === NULL ? '' : ' = ' . Helpers::dump ($ property ->value ))
@@ -139,7 +139,7 @@ public function __toString()
139139 }
140140
141141 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" : '' )
143143 . ($ this ->abstract ? 'abstract ' : '' )
144144 . ($ this ->final ? 'final ' : '' )
145145 . $ this ->type . ' '
0 commit comments