1313use Rector \Autoloading \AdditionalAutoloader ;
1414use Rector \Configuration \ConfigurationFactory ;
1515use Rector \Configuration \ConfigurationRuleFilter ;
16+ use Rector \Configuration \Option ;
1617use Rector \Console \ProcessConfigureDecorator ;
1718use Rector \Parallel \ValueObject \Bridge ;
1819use Rector \StaticReflection \DynamicSourceLocatorDecorator ;
@@ -75,6 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7576 $ promise ->then (function (ConnectionInterface $ connection ) use (
7677 $ parallelIdentifier ,
7778 $ configuration ,
79+ $ input ,
7880 $ output
7981 ): void {
8082 $ inDecoder = new Decoder ($ connection , true , 512 , JSON_INVALID_UTF8_IGNORE );
@@ -85,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8587 ReactCommand::IDENTIFIER => $ parallelIdentifier ,
8688 ]);
8789
88- $ this ->runWorker ($ outEncoder , $ inDecoder , $ configuration , $ output );
90+ $ this ->runWorker ($ outEncoder , $ inDecoder , $ configuration , $ input , $ output );
8991 });
9092
9193 $ streamSelectLoop ->run ();
@@ -97,6 +99,7 @@ private function runWorker(
9799 Encoder $ encoder ,
98100 Decoder $ decoder ,
99101 Configuration $ configuration ,
102+ InputInterface $ input ,
100103 OutputInterface $ output
101104 ): void {
102105 $ this ->additionalAutoloader ->autoloadPaths ();
@@ -128,7 +131,7 @@ private function runWorker(
128131 $ encoder ->on (ReactEvent::ERROR , $ handleErrorCallback );
129132
130133 // 2. collect diffs + errors from file processor
131- $ decoder ->on (ReactEvent::DATA , function (array $ json ) use ($ preFileCallback , $ encoder , $ configuration ): void {
134+ $ decoder ->on (ReactEvent::DATA , function (array $ json ) use ($ preFileCallback , $ encoder , $ configuration, $ input ): void {
132135 $ action = $ json [ReactCommand::ACTION ];
133136 if ($ action !== Action::MAIN ) {
134137 return ;
@@ -151,7 +154,7 @@ private function runWorker(
151154 $ encoder ->write ([
152155 ReactCommand::ACTION => Action::RESULT ,
153156 self ::RESULT => [
154- Bridge::FILE_DIFFS => $ processResult ->getFileDiffs (),
157+ Bridge::FILE_DIFFS => $ processResult ->getFileDiffs ($ input -> getOption (Option:: OUTPUT_FORMAT ) !== ' json ' ),
155158 Bridge::FILES_COUNT => count ($ filePaths ),
156159 Bridge::SYSTEM_ERRORS => $ processResult ->getSystemErrors (),
157160 Bridge::SYSTEM_ERRORS_COUNT => count ($ processResult ->getSystemErrors ()),
0 commit comments