Skip to content

Commit 453bd56

Browse files
committed
simpler docblock
1 parent 03e754e commit 453bd56

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Rector\DeadCode\Rector\Expression;
66

7+
use PhpParser\Comment\Doc;
78
use PhpParser\Node;
89
use PhpParser\Node\Expr\PropertyFetch;
910
use PhpParser\Node\Expr\StaticPropertyFetch;
@@ -108,7 +109,7 @@ private function hasGetMagic(Expression $expression): bool
108109
*/
109110
private function removeNodeAndKeepComments(Expression $expression): int|Node
110111
{
111-
if ($expression->getComments() !== []) {
112+
if ($expression->getDocComment() instanceof Doc) {
112113
$nop = new Nop();
113114
$nop->setDocComment($expression->getDocComment());
114115

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::COMMENT_CLOSURE_RETURN_MIRRORED, true);
92+
$arrowFunction->setAttribute(AttributeKey::COMMENTS, true);
9393
}
9494

9595
return $arrowFunction;

src/NodeTypeResolver/Node/AttributeKey.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ final class AttributeKey
9292
*/
9393
public const WRAPPED_IN_PARENTHESES = 'wrapped_in_parentheses';
9494

95-
/**
96-
* @var string
97-
*/
98-
public const COMMENT_CLOSURE_RETURN_MIRRORED = 'comment_closure_return_mirrored';
99-
10095
/**
10196
* To pass PHP 8.0 attribute FQN names
10297
* @var string

src/PhpParser/Printer/BetterStandardPrinter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function p(
161161

162162
protected function pExpr_ArrowFunction(ArrowFunction $arrowFunction, int $precedence, int $lhsPrecedence): string
163163
{
164-
if (! $arrowFunction->hasAttribute(AttributeKey::COMMENT_CLOSURE_RETURN_MIRRORED)) {
164+
if (! $arrowFunction->hasAttribute(AttributeKey::COMMENTS)) {
165165
return parent::pExpr_ArrowFunction($arrowFunction, $precedence, $lhsPrecedence);
166166
}
167167

0 commit comments

Comments
 (0)