From f6da351d834df51cc52d267a3153660d2cca3b3e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 9 Jan 2026 18:27:28 +0700 Subject: [PATCH] [DeadCode] Skip private promoted property on RemoveParentDelegatingConstructorRector --- .../skip_private_property_promotion.php.inc | 18 ++++++++++++++++++ .../SomeParentWithPrivatePropertyPromotion.php | 12 ++++++++++++ ...RemoveParentDelegatingConstructorRector.php | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_private_property_promotion.php.inc create mode 100644 rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Source/SomeParentWithPrivatePropertyPromotion.php diff --git a/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_private_property_promotion.php.inc b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_private_property_promotion.php.inc new file mode 100644 index 00000000000..22a98dd1e6a --- /dev/null +++ b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_private_property_promotion.php.inc @@ -0,0 +1,18 @@ +d->format('Y-m-d'); + } +} diff --git a/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Source/SomeParentWithPrivatePropertyPromotion.php b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Source/SomeParentWithPrivatePropertyPromotion.php new file mode 100644 index 00000000000..731284c25ee --- /dev/null +++ b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Source/SomeParentWithPrivatePropertyPromotion.php @@ -0,0 +1,12 @@ +getParams() as $position => $param) { + if ($param->isPromoted() && $param->isPrivate()) { + return false; + } + $parameterType = $param->type; // no type override