88use Rector \ChangesReporting \Contract \Output \OutputFormatterInterface ;
99use Rector \Configuration \Option ;
1010use Rector \Configuration \Parameter \SimpleParameterProvider ;
11+ use Rector \Console \Style \RectorStyle ;
1112use Rector \ValueObject \Configuration ;
1213use Rector \ValueObject \Error \SystemError ;
1314use Rector \ValueObject \ProcessResult ;
1415use Rector \ValueObject \Reporting \FileDiff ;
1516use Symfony \Component \Console \Formatter \OutputFormatter ;
16- use Symfony \Component \Console \Style \SymfonyStyle ;
1717
1818final readonly class ConsoleOutputFormatter implements OutputFormatterInterface
1919{
2525 private const string ON_LINE_REGEX = '# on line # ' ;
2626
2727 public function __construct (
28- private SymfonyStyle $ symfonyStyle ,
28+ private RectorStyle $ rectorStyle ,
2929 ) {
3030 }
3131
@@ -43,15 +43,15 @@ public function report(ProcessResult $processResult, Configuration $configuratio
4343
4444 // to keep space between progress bar and success message
4545 if ($ configuration ->shouldShowProgressBar () && $ processResult ->getFileDiffs () === []) {
46- $ this ->symfonyStyle ->newLine ();
46+ $ this ->rectorStyle ->newLine ();
4747 }
4848
4949 if ($ configuration ->shouldShowRulesSummary ()) {
5050 $ this ->reportRulesSummary ($ processResult , $ configuration );
5151 }
5252
5353 $ message = $ this ->createSuccessMessage ($ processResult , $ configuration );
54- $ this ->symfonyStyle ->success ($ message );
54+ $ this ->rectorStyle ->success ($ message );
5555 }
5656
5757 public function getName (): string
@@ -72,7 +72,7 @@ private function reportFileDiffs(array $fileDiffs, bool $absoluteFilePath): void
7272 ksort ($ fileDiffs );
7373 $ message = sprintf ('%d file%s with changes ' , count ($ fileDiffs ), count ($ fileDiffs ) === 1 ? '' : 's ' );
7474
75- $ this ->symfonyStyle ->title ($ message );
75+ $ this ->rectorStyle ->title ($ message );
7676
7777 $ i = 0 ;
7878 foreach ($ fileDiffs as $ fileDiff ) {
@@ -95,14 +95,14 @@ private function reportFileDiffs(array $fileDiffs, bool $absoluteFilePath): void
9595
9696 $ message = sprintf ('<options=bold>%d) %s</> ' , ++$ i , $ filePathWithUrl );
9797
98- $ this ->symfonyStyle ->writeln ($ message );
99- $ this ->symfonyStyle ->newLine ();
100- $ this ->symfonyStyle ->writeln ($ fileDiff ->getDiffConsoleFormatted ());
98+ $ this ->rectorStyle ->writeln ($ message );
99+ $ this ->rectorStyle ->newLine ();
100+ $ this ->rectorStyle ->writeln ($ fileDiff ->getDiffConsoleFormatted ());
101101
102102 if ($ fileDiff ->getRectorChanges () !== []) {
103- $ this ->symfonyStyle ->writeln ('<options=underscore>Applied rules:</> ' );
104- $ this ->symfonyStyle ->listing ($ fileDiff ->getRectorShortClasses ());
105- $ this ->symfonyStyle ->newLine ();
103+ $ this ->rectorStyle ->writeln ('<options=underscore>Applied rules:</> ' );
104+ $ this ->rectorStyle ->listing ($ fileDiff ->getRectorShortClasses ());
105+ $ this ->rectorStyle ->newLine ();
106106 }
107107 }
108108 }
@@ -131,7 +131,7 @@ private function reportErrors(array $errors, bool $absoluteFilePath): void
131131 $ message .= ' On line: ' . $ error ->getLine ();
132132 }
133133
134- $ this ->symfonyStyle ->error ($ message );
134+ $ this ->rectorStyle ->error ($ message );
135135 }
136136 }
137137
@@ -144,11 +144,11 @@ private function reportRulesSummary(ProcessResult $processResult, Configuration
144144
145145 $ verb = $ configuration ->isDryRun () ? 'would have been applied ' : 'was applied ' ;
146146
147- $ this ->symfonyStyle ->section ('Rules Summary ' );
147+ $ this ->rectorStyle ->section ('Rules Summary ' );
148148
149149 foreach ($ ruleApplicationCounts as $ ruleClass => $ count ) {
150150 $ ruleShortClass = (string ) Strings ::after ($ ruleClass , '\\' , -1 );
151- $ this ->symfonyStyle ->writeln (sprintf (
151+ $ this ->rectorStyle ->writeln (sprintf (
152152 ' * <info>%s</info> %s <comment>%d</comment> time%s ' ,
153153 $ ruleShortClass ,
154154 $ verb ,
@@ -157,7 +157,7 @@ private function reportRulesSummary(ProcessResult $processResult, Configuration
157157 ));
158158 }
159159
160- $ this ->symfonyStyle ->newLine ();
160+ $ this ->rectorStyle ->newLine ();
161161 }
162162
163163 private function normalizePathsToRelativeWithLine (string $ errorMessage ): string
0 commit comments