From 2636fc787116307a1a0ad8314d39a43cda29859b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 29 Aug 2026 10:22:36 +0200 Subject: [PATCH 1/2] [Tests] Remove redundant Issues tests, move symfony dependency case to rector-symfony --- .../AddClassDependencyTest.php | 28 --------- .../Fixture/fixture.php.inc | 57 ------------------- .../Fixture/strick_with_constructor.php.inc | 43 -------------- .../Source/SomeAutowiredService.php | 9 --- .../config/configured_rule.php | 9 --- ...structorPromoAnnotationToAttributeTest.php | 28 --------- .../Fixture/fixture.php.inc | 44 -------------- .../config/configured_rule.php | 15 ----- .../Issues/Issue6420/Fixture/fixture.php.inc | 27 --------- ...meFunctionWithRemoveDeadStmtRectorTest.php | 31 ---------- .../Issue6420/config/configured_rule.php | 16 ------ 11 files changed, 307 deletions(-) delete mode 100644 tests/Issues/AddClassDependency/AddClassDependencyTest.php delete mode 100644 tests/Issues/AddClassDependency/Fixture/fixture.php.inc delete mode 100644 tests/Issues/AddClassDependency/Fixture/strick_with_constructor.php.inc delete mode 100644 tests/Issues/AddClassDependency/Source/SomeAutowiredService.php delete mode 100644 tests/Issues/AddClassDependency/config/configured_rule.php delete mode 100644 tests/Issues/ConstructorPromoAnnotationToAttribute/ConstructorPromoAnnotationToAttributeTest.php delete mode 100644 tests/Issues/ConstructorPromoAnnotationToAttribute/Fixture/fixture.php.inc delete mode 100644 tests/Issues/ConstructorPromoAnnotationToAttribute/config/configured_rule.php delete mode 100644 tests/Issues/Issue6420/Fixture/fixture.php.inc delete mode 100644 tests/Issues/Issue6420/RenameFunctionWithRemoveDeadStmtRectorTest.php delete mode 100644 tests/Issues/Issue6420/config/configured_rule.php diff --git a/tests/Issues/AddClassDependency/AddClassDependencyTest.php b/tests/Issues/AddClassDependency/AddClassDependencyTest.php deleted file mode 100644 index 6cc977287ad..00000000000 --- a/tests/Issues/AddClassDependency/AddClassDependencyTest.php +++ /dev/null @@ -1,28 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/tests/Issues/AddClassDependency/Fixture/fixture.php.inc b/tests/Issues/AddClassDependency/Fixture/fixture.php.inc deleted file mode 100644 index a57efc90db8..00000000000 --- a/tests/Issues/AddClassDependency/Fixture/fixture.php.inc +++ /dev/null @@ -1,57 +0,0 @@ -someAutowiredService = $someAutowiredService; - } - - public function configure() - { - $someType = $this->get('validator'); - } -} - -?> ------ -someAutowiredService = $someAutowiredService; - $this->validator = $validator; - } - - public function configure() - { - $someType = $this->validator; - } -} - -?> diff --git a/tests/Issues/AddClassDependency/Fixture/strick_with_constructor.php.inc b/tests/Issues/AddClassDependency/Fixture/strick_with_constructor.php.inc deleted file mode 100644 index 11e65dfb871..00000000000 --- a/tests/Issues/AddClassDependency/Fixture/strick_with_constructor.php.inc +++ /dev/null @@ -1,43 +0,0 @@ -get('validator'); - } -} - -?> ------ -validator; - } -} - -?> diff --git a/tests/Issues/AddClassDependency/Source/SomeAutowiredService.php b/tests/Issues/AddClassDependency/Source/SomeAutowiredService.php deleted file mode 100644 index 8c4ca1776e4..00000000000 --- a/tests/Issues/AddClassDependency/Source/SomeAutowiredService.php +++ /dev/null @@ -1,9 +0,0 @@ -withRules([GetBySymfonyStringToConstructorInjectionRector::class]); diff --git a/tests/Issues/ConstructorPromoAnnotationToAttribute/ConstructorPromoAnnotationToAttributeTest.php b/tests/Issues/ConstructorPromoAnnotationToAttribute/ConstructorPromoAnnotationToAttributeTest.php deleted file mode 100644 index 9842ae4271c..00000000000 --- a/tests/Issues/ConstructorPromoAnnotationToAttribute/ConstructorPromoAnnotationToAttributeTest.php +++ /dev/null @@ -1,28 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/tests/Issues/ConstructorPromoAnnotationToAttribute/Fixture/fixture.php.inc b/tests/Issues/ConstructorPromoAnnotationToAttribute/Fixture/fixture.php.inc deleted file mode 100644 index 0d50e53ab52..00000000000 --- a/tests/Issues/ConstructorPromoAnnotationToAttribute/Fixture/fixture.php.inc +++ /dev/null @@ -1,44 +0,0 @@ -items = $items; - } -} -?> ------ - diff --git a/tests/Issues/ConstructorPromoAnnotationToAttribute/config/configured_rule.php b/tests/Issues/ConstructorPromoAnnotationToAttribute/config/configured_rule.php deleted file mode 100644 index 3d2b7a54895..00000000000 --- a/tests/Issues/ConstructorPromoAnnotationToAttribute/config/configured_rule.php +++ /dev/null @@ -1,15 +0,0 @@ -rule(ClassPropertyAssignToConstructorPromotionRector::class); - $rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [ - new AnnotationToAttribute('OldTag', 'NewAttribute'), - ]); -}; diff --git a/tests/Issues/Issue6420/Fixture/fixture.php.inc b/tests/Issues/Issue6420/Fixture/fixture.php.inc deleted file mode 100644 index 3afa09ada7a..00000000000 --- a/tests/Issues/Issue6420/Fixture/fixture.php.inc +++ /dev/null @@ -1,27 +0,0 @@ - ------ - diff --git a/tests/Issues/Issue6420/RenameFunctionWithRemoveDeadStmtRectorTest.php b/tests/Issues/Issue6420/RenameFunctionWithRemoveDeadStmtRectorTest.php deleted file mode 100644 index 22a723b7d55..00000000000 --- a/tests/Issues/Issue6420/RenameFunctionWithRemoveDeadStmtRectorTest.php +++ /dev/null @@ -1,31 +0,0 @@ -doTestFile($filePath); - } - - public static function provideData(): Iterator - { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); - } - - public function provideConfigFilePath(): string - { - return __DIR__ . '/config/configured_rule.php'; - } -} diff --git a/tests/Issues/Issue6420/config/configured_rule.php b/tests/Issues/Issue6420/config/configured_rule.php deleted file mode 100644 index c1c5b84d400..00000000000 --- a/tests/Issues/Issue6420/config/configured_rule.php +++ /dev/null @@ -1,16 +0,0 @@ -rule(RemoveDeadStmtRector::class); - - $rectorConfig - ->ruleWithConfiguration(RenameFunctionRector::class, [ - 'preg_replace' => 'Safe\preg_replace', - ]); -}; From 7bb2edcc12c01eadb81309a3658eebc98ed736a6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 29 Aug 2026 08:41:28 +0000 Subject: [PATCH 2/2] [ci-review] Rector Rectify --- src/Config/RectorConfig.php | 1 - src/VendorLocker/ParentClassMethodTypeOverrideGuard.php | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index 0697c6ef53a..ac3ed8bcd80 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -7,7 +7,6 @@ use Composer\Semver\Semver; use Deprecated; use Entropy\Container\Container; -use Override; use Rector\Caching\Contract\ValueObject\Storage\CacheStorageInterface; use Rector\Composer\InstalledPackageResolver; use Rector\Configuration\Option; diff --git a/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php b/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php index 7e269c88868..c11b762200f 100644 --- a/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php +++ b/src/VendorLocker/ParentClassMethodTypeOverrideGuard.php @@ -4,6 +4,8 @@ namespace Rector\VendorLocker; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\Interface_; use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; use PHPStan\Reflection\ClassReflection; @@ -38,7 +40,7 @@ public function __construct( * classes, so type-declaration rules must leave it untouched. Final classes are never guarded, * as they cannot be extended. */ - public function isTypeGuardedClass(Node\Stmt\Class_|Node\Stmt\Interface_|ClassMethod $node): bool + public function isTypeGuardedClass(Class_|Interface_|ClassMethod $node): bool { $guardedClasses = SimpleParameterProvider::provideArrayParameter(Option::TYPE_GUARDED_CLASSES); if ($guardedClasses === []) {