diff --git a/rules-tests/Php81/Rector/Property/ReadOnlyPropertyRector/Fixture/skip_param_hook.php.inc b/rules-tests/Php81/Rector/Property/ReadOnlyPropertyRector/Fixture/skip_param_hook.php.inc new file mode 100644 index 00000000000..479df9a4173 --- /dev/null +++ b/rules-tests/Php81/Rector/Property/ReadOnlyPropertyRector/Fixture/skip_param_hook.php.inc @@ -0,0 +1,14 @@ +foo; + } + }) + { + } +} diff --git a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php index adc666937c3..49dd58c134a 100644 --- a/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php +++ b/rules/Php81/Rector/Property/ReadOnlyPropertyRector.php @@ -224,6 +224,10 @@ private function refactorParam(Class_ $class, ClassMethod $classMethod, Param $p return null; } + if ($param->hooks !== []) { + return null; + } + if ($this->propertyManipulator->isPropertyChangeableExceptConstructor($class, $param, $scope)) { return null; }