From 44a4d0ba09d25f49ea83e3273974854832febe03 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 7 Jan 2026 12:52:23 +0100 Subject: [PATCH 1/2] cs --- .../config/configured_rule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Issues/IssuePropertyPromoRemoveDelegatingParent/config/configured_rule.php b/tests/Issues/IssuePropertyPromoRemoveDelegatingParent/config/configured_rule.php index 75e42bde090..374e00d4f13 100644 --- a/tests/Issues/IssuePropertyPromoRemoveDelegatingParent/config/configured_rule.php +++ b/tests/Issues/IssuePropertyPromoRemoveDelegatingParent/config/configured_rule.php @@ -8,4 +8,4 @@ ->withRules([ ClassPropertyAssignToConstructorPromotionRector::class, RemoveParentDelegatingConstructorRector::class, - ]); \ No newline at end of file + ]); From e660218cf5aa6cff8e9834691f07f148a338d073 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 7 Jan 2026 12:58:51 +0100 Subject: [PATCH 2/2] skip marker attribute in RemoveUnusedConstructorParamRector --- .../Fixture/skip_attribute_marker.php.inc | 16 ++++++++++++++++ .../RemoveUnusedConstructorParamRector.php | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 rules-tests/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector/Fixture/skip_attribute_marker.php.inc diff --git a/rules-tests/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector/Fixture/skip_attribute_marker.php.inc b/rules-tests/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector/Fixture/skip_attribute_marker.php.inc new file mode 100644 index 00000000000..37573cbe5cd --- /dev/null +++ b/rules-tests/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector/Fixture/skip_attribute_marker.php.inc @@ -0,0 +1,16 @@ +getInterfaces(); foreach ($interfaces as $interface) { + // parameters are contract required → skip if ($interface->hasNativeMethod(MethodName::CONSTRUCT)) { return null; } } + // attributes can be used as markers + if ($classReflection->isAttributeClass() && $constructorClassMethod->getDocComment() instanceof Doc) { + return null; + } + $changedConstructorClassMethod = $this->classMethodParamRemover->processRemoveParams($constructorClassMethod); if (! $changedConstructorClassMethod instanceof ClassMethod) { return null;