@@ -88,8 +88,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888 }
8989 $ data ['tests ' ] = array_keys ($ data ['tests ' ]);
9090 $ data ['loader_paths ' ] = $ this ->getLoaderPaths ();
91+ $ wrongBundles = $ this ->findWrongBundleOverrides ();
92+ if ($ wrongBundles ) {
93+ $ data ['warnings ' ] = array ();
94+
95+ $ messages = $ this ->buildWarningMessages ($ this ->findWrongBundleOverrides ());
96+ $ data ['warnings ' ] = array_reduce (
97+ $ messages ,
98+ function ($ carry , $ message ) {
99+ $ carry [] = $ message ;
100+
101+ return $ carry ;
102+ },
103+ array ()
104+ );
105+ }
106+
91107 $ io ->writeln (json_encode ($ data ));
92- $ this ->displayAlternatives ($ this ->findWrongBundleOverrides (), $ io );
93108
94109 return 0 ;
95110 }
@@ -130,7 +145,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
130145 array_pop ($ rows );
131146 $ io ->section ('Loader Paths ' );
132147 $ io ->table (array ('Namespace ' , 'Paths ' ), $ rows );
133- $ this ->displayAlternatives ($ this ->findWrongBundleOverrides (), $ io );
148+
8000
$ messages = $ this ->buildWarningMessages ($ this ->findWrongBundleOverrides ());
149+ array_walk (
150+ $ messages ,
151+ function ($ message ) use ($ io ) {
152+ $ io ->warning (trim ($ message ));
153+ }
154+ );
134155
135156 return 0 ;
136157 }
@@ -312,8 +333,9 @@ function ($carry, $absolutePath) use ($relativePath) {
312333 return $ alternatives ;
313334 }
314335
315- private function displayAlternatives (array $ wrongBundles, SymfonyStyle $ io ): void
336+ private function buildWarningMessages (array $ wrongBundles ): array
316337 {
338+ $ messages = array ();
317339 foreach ($ wrongBundles as $ path => $ alternatives ) {
318340 $ message = sprintf ('Path "%s" not matching any bundle found ' , $ path );
319341 if ($ alternatives ) {
@@ -326,7 +348,9 @@ private function displayAlternatives(array $wrongBundles, SymfonyStyle $io): voi
326348 }
327349 }
328350 }
329- $ io -> warning ( trim ( $ message)) ;
351+ $ messages [] = $ message ;
330352 }
353+
354+ return $ messages ;
331355 }
332356}
0 commit comments