From 9166775d9a5809c961d279a3d2c7f352b8c8b861 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 25 Oct 2026 21:25:05 +0100 Subject: [PATCH 1/3] use safer name fetchClassLikeReflection() --- rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php | 2 +- .../Class_/RemoveRefactorDuplicatedNodeInstanceCheckRector.php | 2 +- rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php | 2 +- .../MethodCall/ThisCallOnStaticMethodToStaticCallRector.php | 2 +- .../ClassMethod/AddParamBasedOnParentClassMethodRector.php | 2 +- .../Rector/ClassConst/PrivatizeFinalClassConstantRector.php | 2 +- .../Rector/ClassMethod/PrivatizeFinalClassMethodRector.php | 2 +- .../ObjectTypedPropertyFromJMSSerializerAttributeTypeRector.php | 2 +- .../Class_/DocblockVarArrayFromPropertyDefaultsRector.php | 2 +- src/Rector/AbstractRector.php | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php b/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php index 5151aec2cb3..5103dbd3839 100644 --- a/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php +++ b/rules/CodeQuality/Rector/Class_/ConvertStaticToSelfRector.php @@ -80,7 +80,7 @@ public function refactor(Node $node): ?Class_ $scope = null; - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/DeadCode/Rector/Class_/RemoveRefactorDuplicatedNodeInstanceCheckRector.php b/rules/DeadCode/Rector/Class_/RemoveRefactorDuplicatedNodeInstanceCheckRector.php index 75b53dad4be..2883edade2d 100644 --- a/rules/DeadCode/Rector/Class_/RemoveRefactorDuplicatedNodeInstanceCheckRector.php +++ b/rules/DeadCode/Rector/Class_/RemoveRefactorDuplicatedNodeInstanceCheckRector.php @@ -90,7 +90,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php b/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php index e88e6af7bef..604baf5584d 100644 --- a/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php +++ b/rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php @@ -89,7 +89,7 @@ public function refactor(Node $node): Class_|null return null; } - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php index d0a07c813b7..27142783a1b 100644 --- a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php +++ b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php @@ -92,7 +92,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php b/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php index cc6fe3f7d94..3b2002e7e00 100644 --- a/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php +++ b/rules/Php80/Rector/ClassMethod/AddParamBasedOnParentClassMethodRector.php @@ -112,7 +112,7 @@ public function refactor(Node $node): ?Node $hasChanged = false; - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/Privatization/Rector/ClassConst/PrivatizeFinalClassConstantRector.php b/rules/Privatization/Rector/ClassConst/PrivatizeFinalClassConstantRector.php index e9014daf360..aed2a4cb513 100644 --- a/rules/Privatization/Rector/ClassConst/PrivatizeFinalClassConstantRector.php +++ b/rules/Privatization/Rector/ClassConst/PrivatizeFinalClassConstantRector.php @@ -67,7 +67,7 @@ public function refactor(Node $node): ?Node return null; } - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php index e0c7e1900a7..8016c9857ed 100644 --- a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php +++ b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php @@ -79,7 +79,7 @@ public function refactor(Node $node): ?Node return null; } - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/TypeDeclaration/Rector/Class_/ObjectTypedPropertyFromJMSSerializerAttributeTypeRector.php b/rules/TypeDeclaration/Rector/Class_/ObjectTypedPropertyFromJMSSerializerAttributeTypeRector.php index b3c3fa16b31..c799d0863d7 100644 --- a/rules/TypeDeclaration/Rector/Class_/ObjectTypedPropertyFromJMSSerializerAttributeTypeRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ObjectTypedPropertyFromJMSSerializerAttributeTypeRector.php @@ -82,7 +82,7 @@ public function refactor(Node $node): ?Node return null; } - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php index 2d68f1bb916..bcfcad9b6d6 100644 --- a/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php +++ b/rules/TypeDeclarationDocblocks/Rector/Class_/DocblockVarArrayFromPropertyDefaultsRector.php @@ -70,7 +70,7 @@ public function refactor(Node $node): ?Node { $hasChanged = false; - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index 4aa2c2b04cb..02c3a2786c5 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -67,7 +67,7 @@ public function autowire( $this->reflectionProvider = $reflectionProvider; } - protected function getClassReflection(ClassLike $classLike): ?ClassReflection + protected function fetchClassLikeReflection(ClassLike $classLike): ?ClassReflection { $className = $this->getName($classLike); if ($className === null) { From 8e378506d5c7bc6827a5983b7e982a818bad42c1 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 25 Oct 2026 21:26:08 +0100 Subject: [PATCH 2/3] [Visibility] Retarget ChangeMethodVisibilityRector to Class_ node --- rules/Visibility/Rector/Class_/ChangeMethodVisibilityRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/Visibility/Rector/Class_/ChangeMethodVisibilityRector.php b/rules/Visibility/Rector/Class_/ChangeMethodVisibilityRector.php index 7a0451e392d..d85f3d7e5ed 100644 --- a/rules/Visibility/Rector/Class_/ChangeMethodVisibilityRector.php +++ b/rules/Visibility/Rector/Class_/ChangeMethodVisibilityRector.php @@ -92,7 +92,7 @@ public function refactor(Node $node): ?Node return null; } - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } From b4bba9bb5e189eabfaf2fe1d578e2abb493ae824 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 25 Oct 2026 23:53:03 +0100 Subject: [PATCH 3/3] apply fetchClassLikeReflection() rename to callers merged from main --- .../Rector/ClassLike/AddVoidReturnTypeWhereNoReturnRector.php | 2 +- .../Rector/Class_/ReturnTypeFromMockObjectRector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/TypeDeclaration/Rector/ClassLike/AddVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/ClassLike/AddVoidReturnTypeWhereNoReturnRector.php index f34dd3d8577..300166209d7 100644 --- a/rules/TypeDeclaration/Rector/ClassLike/AddVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassLike/AddVoidReturnTypeWhereNoReturnRector.php @@ -73,7 +73,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; } diff --git a/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromMockObjectRector.php b/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromMockObjectRector.php index 5e9f7f8f8b3..d9fe72f6990 100644 --- a/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromMockObjectRector.php +++ b/rules/TypeDeclaration/Rector/Class_/ReturnTypeFromMockObjectRector.php @@ -75,7 +75,7 @@ public function getNodeTypes(): array */ public function refactor(Node $node): ?Node { - $classReflection = $this->getClassReflection($node); + $classReflection = $this->fetchClassLikeReflection($node); if (! $classReflection instanceof ClassReflection) { return null; }