@@ -48,20 +48,34 @@ public function reportUnusedSkips(ProcessResult $processResult): void
4848 if (!SimpleParameterProvider::provideBoolParameter (Option::REPORT_UNUSED_SKIPS , \false)) {
4949 return ;
5050 }
51- // rule-scoped path skips are trackable at runtime; skip-everywhere rule skips
52- // (null path) are forgotten from the container at boot, so they never reach the skipper.
53- // rule-scoped paths are intentional, so they are reported even as mask paths
54- $ skippedClassPaths = [];
55- foreach ($ this ->skippedClassResolver ->resolve () as $ paths ) {
51+ // map of trackable skip path => human-readable display; skips are tracked at runtime by
52+ // their path, but rule-scoped ones are printed as "rule => path" so the user knows exactly
53+ // what to remove. Skip-everywhere rule skips (null path) are forgotten from the container
54+ // at boot, so they never reach the skipper and cannot be tracked.
55+ $ skipDisplaysByPath = [];
56+ foreach ($ this ->skippedClassResolver ->resolve () as $ rectorClass => $ paths ) {
5657 if ($ paths === null ) {
5758 continue ;
5859 }
59- $ skippedClassPaths = array_merge ($ skippedClassPaths , $ paths );
60+ // rule-scoped paths are intentional, so they are reported even as mask paths
61+ foreach ($ paths as $ path ) {
62+ $ skipDisplaysByPath [$ path ] = $ rectorClass . ' => ' . $ path ;
63+ }
6064 }
6165 // global mask paths like "*/some/*" are hard to spot and report false positives, skip them
62- $ globalPaths = array_filter ($ this ->skippedPathsResolver ->resolve (), static fn (string $ skip ): bool => strpos ($ skip , '* ' ) === \false);
63- $ configuredSkips = array_merge ($ skippedClassPaths , $ globalPaths );
64- $ unusedSkips = array_values (array_diff ($ configuredSkips , $ processResult ->getUsedSkips ()));
66+ foreach ($ this ->skippedPathsResolver ->resolve () as $ globalPath ) {
67+ if (strpos ($ globalPath , '* ' ) !== \false) {
68+ continue ;
69+ }
70+ $ skipDisplaysByPath [$ globalPath ] = $ globalPath ;
71+ }
72+ $ usedSkips = $ processResult ->getUsedSkips ();
73+ $ unusedSkips = [];
74+ foreach ($ skipDisplaysByPath as $ path => $ skipDisplay ) {
75+ if (!in_array ($ path , $ usedSkips , \true)) {
76+ $ unusedSkips [] = $ skipDisplay ;
77+ }
78+ }
6579 if ($ unusedSkips === []) {
6680 return ;
6781 }
0 commit comments