From 1e52ef1bb5283037225b11935be451f04ccd5aa3 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 15 Oct 2025 15:08:13 +0700 Subject: [PATCH] =?UTF-8?q?Revert=20"[Php84]=20Skip=20has=20mix=20between?= =?UTF-8?q?=20normal=20property=20and=20readonly=20promoted=20pr=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 64f20de576c9743d752dd465a25cc24320273ccf. --- ...xisting_readonly_promoted_property.php.inc | 29 ------------------- .../NodeFinder/SetterAndGetterFinder.php | 11 ------- 2 files changed, 40 deletions(-) delete mode 100644 rules-tests/Php84/Rector/Class_/PropertyHookRector/Fixture/skip_mix_with_existing_readonly_promoted_property.php.inc diff --git a/rules-tests/Php84/Rector/Class_/PropertyHookRector/Fixture/skip_mix_with_existing_readonly_promoted_property.php.inc b/rules-tests/Php84/Rector/Class_/PropertyHookRector/Fixture/skip_mix_with_existing_readonly_promoted_property.php.inc deleted file mode 100644 index 9e35260873d..00000000000 --- a/rules-tests/Php84/Rector/Class_/PropertyHookRector/Fixture/skip_mix_with_existing_readonly_promoted_property.php.inc +++ /dev/null @@ -1,29 +0,0 @@ -name; - } - - public function setName(string $name): void - { - $this->name = ucfirst($name); - } - - public function __construct( - private readonly int $value, - ) - { - } - - public function getValue() - { - return $this->value; - } -} diff --git a/rules/Php84/NodeFinder/SetterAndGetterFinder.php b/rules/Php84/NodeFinder/SetterAndGetterFinder.php index 1ffd6a95bf0..2adcc7f15be 100644 --- a/rules/Php84/NodeFinder/SetterAndGetterFinder.php +++ b/rules/Php84/NodeFinder/SetterAndGetterFinder.php @@ -7,7 +7,6 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use Rector\TypeDeclaration\NodeAnalyzer\ClassMethodAndPropertyAnalyzer; -use Rector\ValueObject\MethodName; final readonly class SetterAndGetterFinder { @@ -23,16 +22,6 @@ public function findGetterAndSetterClassMethods(Class_ $class, string $propertyN { $classMethods = []; - $constructClassMethod = $class->getMethod(MethodName::CONSTRUCT); - - if ($constructClassMethod instanceof ClassMethod) { - foreach ($constructClassMethod->params as $param) { - if ($param->isReadonly()) { - return []; - } - } - } - $getterClassMethod = $this->findGetterClassMethod($class, $propertyName); if ($getterClassMethod instanceof ClassMethod) { $classMethods[] = $getterClassMethod;