Skip to content

Commit 9aa1d3b

Browse files
committed
keep comments directly
1 parent bed985c commit 9aa1d3b

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"rector/type-perfect": "^2.1",
5757
"shipmonk/composer-dependency-analyser": "^1.8",
5858
"symplify/phpstan-extensions": "^12.0.2",
59-
"symplify/phpstan-rules": "dev-main#669b317",
59+
"symplify/phpstan-rules": "dev-main",
6060
"symplify/vendor-patches": "^11.5",
6161
"tomasvotruba/class-leak": "^2.1",
6262
"tomasvotruba/unused-public": "^2.1",

rules/DeadCode/Rector/Expression/RemoveDeadStmtRector.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
use PhpParser\Node\Stmt\Nop;
1212
use PhpParser\NodeVisitor;
1313
use PHPStan\Reflection\Php\PhpPropertyReflection;
14-
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
1514
use Rector\DeadCode\NodeManipulator\LivingCodeManipulator;
1615
use Rector\NodeAnalyzer\PropertyFetchAnalyzer;
17-
use Rector\NodeTypeResolver\Node\AttributeKey;
1816
use Rector\Rector\AbstractRector;
1917
use Rector\Reflection\ReflectionResolver;
2018
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -29,7 +27,6 @@ public function __construct(
2927
private readonly LivingCodeManipulator $livingCodeManipulator,
3028
private readonly PropertyFetchAnalyzer $propertyFetchAnalyzer,
3129
private readonly ReflectionResolver $reflectionResolver,
32-
private readonly PhpDocInfoFactory $phpDocInfoFactory
3330
) {
3431
}
3532

@@ -111,11 +108,9 @@ private function hasGetMagic(Expression $expression): bool
111108
*/
112109
private function removeNodeAndKeepComments(Expression $expression): int|Node
113110
{
114-
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($expression);
115-
116111
if ($expression->getComments() !== []) {
117112
$nop = new Nop();
118-
$nop->setAttribute(AttributeKey::PHP_DOC_INFO, $phpDocInfo);
113+
$nop->setDocComment($expression->getDocComment());
119114

120115
return $nop;
121116
}

src/NodeTypeResolver/Node/AttributeKey.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ final class AttributeKey
8181
*/
8282
public const IS_REGULAR_PATTERN = 'is_regular_pattern';
8383

84-
/**
85-
* @var string
86-
*/
87-
public const DO_NOT_CHANGE = 'do_not_change';
88-
8984
/**
9085
* Helps with infinite loop detection
9186
* @var string
@@ -114,6 +109,7 @@ final class AttributeKey
114109
public const EXTRA_USE_IMPORT = 'extra_use_import';
115110

116111
/**
112+
* Used internally by php-parser
117113
* @var string
118114
*/
119115
public const DOC_LABEL = 'docLabel';

0 commit comments

Comments
 (0)