Skip to content

Commit 6502d60

Browse files
committed
Updated Rector to commit df98b3b4e5f024d2260edc233dc9cb4adfe6a3e0
rectorphp/rector-src@df98b3b [skip] display skips only on uncached run (#8071)
1 parent b74237c commit 6502d60

5 files changed

Lines changed: 26 additions & 3 deletions

File tree

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '84ab911ef53267aa1c4a9466064def614e486eea';
22+
public const PACKAGE_VERSION = 'df98b3b4e5f024d2260edc233dc9cb4adfe6a3e0';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2026-06-20 23:18:03';
27+
public const RELEASE_DATE = '2026-06-21 10:54:43';
2828
/**
2929
* @var int
3030
*/

src/Caching/UnchangedFilesFilter.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
namespace Rector\Caching;
55

66
use Rector\Caching\Detector\ChangedFilesDetector;
7+
use Rector\Configuration\Option;
8+
use Rector\Configuration\Parameter\SimpleParameterProvider;
79
final class UnchangedFilesFilter
810
{
911
/**
@@ -29,6 +31,11 @@ public function filterFilePaths(array $filePaths): array
2931
$changedFileInfos[] = $filePath;
3032
$this->changedFilesDetector->invalidateFile($filePath);
3133
}
34+
// some files were served from cache, so rules ran on a subset only - unused skip reporting
35+
// would then flag every cached file's skip as falsely unused
36+
if (count($changedFileInfos) < count($filePaths)) {
37+
SimpleParameterProvider::setParameter(Option::IS_CACHED_RUN, \true);
38+
}
3239
return $changedFileInfos;
3340
}
3441
}

src/Configuration/Option.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ final class Option
132132
* @var string
133133
*/
134134
public const IS_RUN_NARROWED = 'is_run_narrowed';
135+
/**
136+
* True when the unchanged-files cache dropped at least one file from the run, so rules only ran
137+
* on the changed subset. Unused skip reporting is then disabled, as skips on cached files never
138+
* get a chance to match and would all look falsely unused.
139+
*
140+
* @internal
141+
* @var string
142+
*/
143+
public const IS_CACHED_RUN = 'is_cached_run';
135144
/**
136145
* @internal Use RectorConfig::fileExtensions() instead
137146
* @var string

src/Reporting/MissConfigurationReporter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public function reportUnusedSkips(ProcessResult $processResult): void
4343
return;
4444
}
4545
$this->symfonyStyle->warning(sprintf('%s never matched any element. You can remove %s from "->withSkip()"', count($unusedSkips) > 1 ? 'These skips are unused, they' : 'This skip is unused, it', count($unusedSkips) > 1 ? 'them' : 'it'));
46-
$this->symfonyStyle->listing($unusedSkips);
46+
// add a blank line between items, so grouped rule skips stay visually separated
47+
$spacedUnusedSkips = array_map(static fn(string $unusedSkip): string => $unusedSkip . "\n", $unusedSkips);
48+
$this->symfonyStyle->listing($spacedUnusedSkips);
4749
}
4850
public function reportSkippedNeverRegisteredRules(): void
4951
{

src/Reporting/UnusedSkipResolver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public function resolve(ProcessResult $processResult): array
5050
if (SimpleParameterProvider::provideBoolParameter(Option::IS_RUN_NARROWED, \false)) {
5151
return [];
5252
}
53+
// a cached run only re-processes changed files, so skips on cached files never get a chance
54+
// to match and would all look falsely unused - reporting them would be noise
55+
if (SimpleParameterProvider::provideBoolParameter(Option::IS_CACHED_RUN, \false)) {
56+
return [];
57+
}
5358
// map of rule => (trackable skip path => relative display path); skips are tracked at
5459
// runtime by their path, but rule-scoped ones are printed grouped under their rule so the
5560
// user knows exactly what to remove. Skip-everywhere rule skips (null path) are forgotten

0 commit comments

Comments
 (0)