diff --git a/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_attribute_decorated_args.php.inc b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_attribute_decorated_args.php.inc new file mode 100644 index 00000000000..4e192c6932c --- /dev/null +++ b/rules-tests/DeadCode/Rector/ClassMethod/RemoveParentDelegatingConstructorRector/Fixture/skip_attribute_decorated_args.php.inc @@ -0,0 +1,14 @@ +doAttributeDecoratedParametersExist($node)) { + return null; + } + return NodeVisitor::REMOVE_NODE; } @@ -291,4 +295,18 @@ private function isDifferentDefaultValue( return false; } + + private function doAttributeDecoratedParametersExist(ClassMethod $classMethod): bool + { + $constructorParams = $classMethod->getParams(); + foreach ($constructorParams as $constructorParam) { + foreach ($constructorParam->attrGroups as $attrGroup) { + if ($attrGroup->attrs !== []) { + return true; + } + } + } + + return false; + } }