@@ -46,6 +46,10 @@ public function report(ProcessResult $processResult, Configuration $configuratio
4646 $ this ->symfonyStyle ->newLine ();
4747 }
4848
49+ if ($ configuration ->shouldShowRulesSummary ()) {
50+ $ this ->reportRulesSummary ($ processResult , $ configuration );
51+ }
52+
4953 $ message = $ this ->createSuccessMessage ($ processResult , $ configuration );
5054 $ this ->symfonyStyle ->success ($ message );
5155 }
@@ -131,6 +135,31 @@ private function reportErrors(array $errors, bool $absoluteFilePath): void
131135 }
132136 }
133137
138+ private function reportRulesSummary (ProcessResult $ processResult , Configuration $ configuration ): void
139+ {
140+ $ ruleApplicationCounts = $ processResult ->getRuleApplicationCounts ();
141+ if ($ ruleApplicationCounts === []) {
142+ return ;
143+ }
144+
145+ $ verb = $ configuration ->isDryRun () ? 'would have been applied ' : 'was applied ' ;
146+
147+ $ this ->symfonyStyle ->section ('Rules Summary ' );
148+
149+ foreach ($ ruleApplicationCounts as $ ruleClass => $ count ) {
150+ $ ruleShortClass = (string ) Strings::after ($ ruleClass , '\\' , -1 );
151+ $ this ->symfonyStyle ->writeln (sprintf (
152+ ' * <info>%s</info> %s <comment>%d</comment> time%s ' ,
153+ $ ruleShortClass ,
154+ $ verb ,
155+ $ count ,
156+ $ count > 1 ? 's ' : ''
157+ ));
158+ }
159+
160+ $ this ->symfonyStyle ->newLine ();
161+ }
162+
134163 private function normalizePathsToRelativeWithLine (string $ errorMessage ): string
135164 {
136165 $ regex = '# ' . preg_quote (getcwd (), '# ' ) . '/# ' ;
0 commit comments