@@ -146,7 +146,7 @@ private function init()
146146 /**
147147 * Returns the exclude file path.
148148 *
149- * @return string
149+ * @return array
150150 */
151151 private function getExcludes (): array
152152 {
@@ -158,14 +158,14 @@ private function getExcludes(): array
158158 }
159159
160160 if (isset ($ extra [self ::KEY_EXCLUDE_FILE ])) {
161- $ excludes_file = $ this ->cwd . ' /config/excludes.php ' ;
161+ $ excludes_file = $ this ->cwd . $ extra [ self :: KEY_EXCLUDE_FILE ] ;
162162 }
163163
164164 if (file_exists ($ excludes_file )) {
165165 return include $ excludes_file ;
166166 }
167167
168- throw new \ InvalidArgumentException ( ' No exclude file or exclude classes found ' ) ;
168+ return [] ;
169169 }
170170
171171 /**
@@ -232,6 +232,7 @@ public function generateFile()
232232 private function createModuleFile ($ classnames )
233233 {
234234 $ baseNamespace = $ this ->getBaseNamespace ();
235+ $ io = $ this ->io ;
235236
236237 $ output = sprintf (
237238 "<?php \n/** \n * %s Modules \n * \n * @package %s \n * @subpackage Config \n */ \n\nreturn array( " ,
@@ -260,14 +261,23 @@ private function createModuleFile($classnames)
260261 );
261262 }
262263
263- $ output .= "\n); \n\n " ;
264+ $ output .= "\n); \n" ;
264265
265- return $ this ->writeFile ($ output );
266+ $ bytes = $ this ->writeFile ($ output );
267+
268+ if (0 === $ bytes ) {
269+ $ io ->write ('<error>Module file could not be created</error> ' );
270+ return 1 ;
271+ }
272+
273+ $ io ->write (sprintf ('<info>Module file created successfully with %d classes</info> ' , count ($ classnames )));
274+
275+ return 0 ;
266276 }
267277
268278 private function writeFile (string $ output ): int
269279 {
270- return file_put_contents ($ this ->getModuleFile (), $ output ) > 0 ? 0 : 1 ;
280+ return file_put_contents ($ this ->getModuleFile (), $ output );
271281 }
272282
273283 private function getClassnameKey (string $ classname ): string
0 commit comments