From 02e227854c5ae12437e31b7ca9dd3123d5199783 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 10 Oct 2026 19:03:01 +0200 Subject: [PATCH 1/2] remove unused Skipper::shouldSkipElement() method --- src/Skipper/Skipper/Skipper.php | 5 ----- tests/Skipper/Skipper/SkipperTest.php | 2 +- tests/Skipper/Skipper/UsedSkipCollectorTest.php | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Skipper/Skipper/Skipper.php b/src/Skipper/Skipper/Skipper.php index 9664e5595c7..8cd52c5f4b4 100644 --- a/src/Skipper/Skipper/Skipper.php +++ b/src/Skipper/Skipper/Skipper.php @@ -27,11 +27,6 @@ public function __construct( ) { } - public function shouldSkipElement(string|object $element): bool - { - return $this->shouldSkipElementAndFilePath($element, __FILE__); - } - public function shouldSkipFilePath(string $filePath): bool { return $this->pathSkipper->shouldSkip($filePath); diff --git a/tests/Skipper/Skipper/SkipperTest.php b/tests/Skipper/Skipper/SkipperTest.php index 33dda0fd5a8..e59175e0b80 100644 --- a/tests/Skipper/Skipper/SkipperTest.php +++ b/tests/Skipper/Skipper/SkipperTest.php @@ -75,7 +75,7 @@ public static function provideDataShouldSkipFilePath(): Iterator #[DataProvider('provideDataShouldSkipElement')] public function testSkipElement(string|object $element, bool $expectedSkip): void { - $resultSkip = $this->skipper->shouldSkipElement($element); + $resultSkip = $this->skipper->shouldSkipElementAndFilePath($element, __FILE__); $this->assertSame($expectedSkip, $resultSkip); } diff --git a/tests/Skipper/Skipper/UsedSkipCollectorTest.php b/tests/Skipper/Skipper/UsedSkipCollectorTest.php index e013a5da95b..9e12d70c48a 100644 --- a/tests/Skipper/Skipper/UsedSkipCollectorTest.php +++ b/tests/Skipper/Skipper/UsedSkipCollectorTest.php @@ -50,7 +50,7 @@ protected function tearDown(): void public function testCollectsOnlyMatchedSkips(): void { $this->skipper->shouldSkipFilePath('tests/Skipper/Skipper/Fixture/SomeSkippedPath/any.txt'); - $this->skipper->shouldSkipElement(FifthElement::class); + $this->skipper->shouldSkipElementAndFilePath(FifthElement::class, __FILE__); $usedSkips = $this->usedSkipCollector->provide(); From c1259e54d63fcdbe45f64d33213c91590d02e07d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 10 Oct 2026 19:10:03 +0200 Subject: [PATCH 2/2] remove redundant testSkipElement, covered by testSkipElementAndFilePath --- tests/Skipper/Skipper/SkipperTest.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/tests/Skipper/Skipper/SkipperTest.php b/tests/Skipper/Skipper/SkipperTest.php index e59175e0b80..8fa8ae21b92 100644 --- a/tests/Skipper/Skipper/SkipperTest.php +++ b/tests/Skipper/Skipper/SkipperTest.php @@ -11,7 +11,6 @@ use Rector\Skipper\Skipper\Skipper; use Rector\Testing\PHPUnit\AbstractLazyTestCase; use Rector\Tests\Skipper\Skipper\Fixture\Element\FifthElement; -use Rector\Tests\Skipper\Skipper\Fixture\Element\ThreeMan; use Rector\Tests\Skipper\Skipper\Source\AnotherClassToSkip; use Rector\Tests\Skipper\Skipper\Source\NotSkippedClass; @@ -69,16 +68,6 @@ public static function provideDataShouldSkipFilePath(): Iterator yield [__DIR__ . '/Fixture/PathSkippedWithMask/another_file.txt', true]; } - /** - * @param object|class-string $element - */ - #[DataProvider('provideDataShouldSkipElement')] - public function testSkipElement(string|object $element, bool $expectedSkip): void - { - $resultSkip = $this->skipper->shouldSkipElementAndFilePath($element, __FILE__); - $this->assertSame($expectedSkip, $resultSkip); - } - #[DataProvider('provideCheckerAndFile')] public function testSkipElementAndFilePath(string $element, string $filePath, bool $expectedSkip): void { @@ -99,14 +88,4 @@ public static function provideCheckerAndFile(): Iterator yield [NotSkippedClass::class, __DIR__ . '/Fixture/someFile', false]; yield [NotSkippedClass::class, __DIR__ . '/Fixture/someOtherFile', false]; } - - /** - * @return Iterator, mixed>> - */ - public static function provideDataShouldSkipElement(): Iterator - { - yield [ThreeMan::class, false]; - yield [FifthElement::class, true]; - yield [new FifthElement(), true]; - } }