From bb06099924d2a0ad981f337840550f834193fe3b Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 18 Dec 2025 10:53:11 +0700 Subject: [PATCH 1/2] Fix crash ->getComments() return must be array over true on ClosureToArrowFunctionRector --- rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php index ae4338ddebf..c21b65b838c 100644 --- a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php +++ b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php @@ -89,7 +89,7 @@ public function refactor(Node $node): ?Node $comments = $node->stmts[0]->getAttribute(AttributeKey::COMMENTS) ?? []; if ($comments !== []) { $this->mirrorComments($arrowFunction->expr, $node->stmts[0]); - $arrowFunction->setAttribute(AttributeKey::COMMENTS, true); + $arrowFunction->setAttribute(AttributeKey::COMMENTS, []); } return $arrowFunction; From 6635c3075e866911254718ce94bb85e9e0a57ff0 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 18 Dec 2025 14:35:37 +0700 Subject: [PATCH 2/2] final touch: mirror comment of ArrowFunction as its stmt --- rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php index c21b65b838c..d183c2f40d6 100644 --- a/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php +++ b/rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php @@ -89,7 +89,7 @@ public function refactor(Node $node): ?Node $comments = $node->stmts[0]->getAttribute(AttributeKey::COMMENTS) ?? []; if ($comments !== []) { $this->mirrorComments($arrowFunction->expr, $node->stmts[0]); - $arrowFunction->setAttribute(AttributeKey::COMMENTS, []); + $arrowFunction->setAttribute(AttributeKey::COMMENTS, $node->stmts[0]->getComments()); } return $arrowFunction;