Skip to content

Commit f914c84

Browse files
authored
Fix crash ->getComments() return must be array over true on ClosureToArrowFunctionRector (#7761)
* Fix crash ->getComments() return must be array over true on ClosureToArrowFunctionRector * final touch: mirror comment of ArrowFunction as its stmt
1 parent 2e1e9cc commit f914c84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rules/Php74/Rector/Closure/ClosureToArrowFunctionRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function refactor(Node $node): ?Node
8989
$comments = $node->stmts[0]->getAttribute(AttributeKey::COMMENTS) ?? [];
9090
if ($comments !== []) {
9191
$this->mirrorComments($arrowFunction->expr, $node->stmts[0]);
92-
$arrowFunction->setAttribute(AttributeKey::COMMENTS, true);
92+
$arrowFunction->setAttribute(AttributeKey::COMMENTS, $node->stmts[0]->getComments());
9393
}
9494

9595
return $arrowFunction;

0 commit comments

Comments
 (0)