@@ -330,6 +330,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
330
330
throw new ShouldNotHappenException ();
331
331
}
332
332
333
+ if ($ fix ) {
334
+ $ inceptionResult ->getErrorOutput ()->writeLineFormatted ('Analysing files... ' );
335
+ }
336
+
333
337
try {
334
338
$ analysisResult = $ application ->analyse (
335
339
$ files ,
@@ -512,7 +516,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
512
516
}
513
517
514
518
$ fixableErrorsCount = count ($ fixableErrors );
515
- if (count ( $ fixableErrors ) === 0 ) {
519
+ if ($ fixableErrorsCount === 0 ) {
516
520
$ inceptionResult ->getStdOutput ()->getStyle ()->error ('No fixable errors found ' );
517
521
$ exitCode = 1 ;
518
522
} else {
@@ -531,18 +535,26 @@ protected function execute(InputInterface $input, OutputInterface $output): int
531
535
$ diffsByFile [$ fixFile ][] = $ fixableError ->getFixedErrorDiff ();
532
536
}
533
537
538
+ $ inceptionResult ->getErrorOutput ()->writeLineFormatted ('Fixing errors... ' );
539
+ $ errorOutput ->getStyle ()->progressStart ($ fixableErrorsCount );
540
+
534
541
$ patcher = $ container ->getByType (Patcher::class);
535
542
foreach ($ diffsByFile as $ file => $ diffs ) {
543
+ $ diffsCount = count ($ diffs );
536
544
try {
537
545
$ finalFileContents = $ patcher ->applyDiffs ($ file , $ diffs );
546
+ $ errorOutput ->getStyle ()->progressAdvance ($ diffsCount );
538
547
} catch (FileChangedException | MergeConflictException ) {
539
- $ skippedCount += count ($ diffs );
548
+ $ skippedCount += $ diffsCount ;
549
+ $ errorOutput ->getStyle ()->progressAdvance ($ diffsCount );
540
550
continue ;
541
551
}
542
552
543
553
FileWriter::write ($ file , $ finalFileContents );
544
554
}
545
555
556
+ $ errorOutput ->getStyle ()->progressFinish ();
557
+
546
558
if ($ skippedCount > 0 ) {
547
559
$ inceptionResult ->getStdOutput ()->getStyle ()->warning (sprintf (
548
560
'%d %s fixed, %d %s skipped ' ,
0 commit comments