Skip to content

Commit 08b98b3

Browse files
Revert reprint same line on DowngradeAttributeToAnnotationRector (#249)
* Revert reprint same line on DowngradeAttributeToAnnotationRector * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <[email protected]>
1 parent f6caa1d commit 08b98b3

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

rules-tests/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector/Fixture/reprint_same_line.php.inc

Lines changed: 0 additions & 24 deletions
This file was deleted.

rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Rector\Contract\Rector\ConfigurableRectorInterface;
2020
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
2121
use Rector\NodeFactory\DoctrineAnnotationFactory;
22-
use Rector\NodeTypeResolver\Node\AttributeKey;
2322
use Rector\Rector\AbstractRector;
2423
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
2524
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@@ -106,14 +105,9 @@ public function refactor(Node $node): ?Node
106105
$this->isDowngraded = false;
107106

108107
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
109-
$requireReprint = false;
110108
foreach ($node->attrGroups as $attrGroup) {
111109
foreach ($attrGroup->attrs as $key => $attribute) {
112110
if ($this->shouldSkipAttribute($attribute)) {
113-
// avoid error on same line
114-
// as attribute ->getStartLine() always equal with node ->getStartLine()
115-
// can't validate it, so enforce to reprint later
116-
$requireReprint = true;
117111
continue;
118112
}
119113

@@ -151,11 +145,6 @@ public function refactor(Node $node): ?Node
151145
$this->cleanupEmptyAttrGroups($node);
152146

153147
if (! $this->isDowngraded) {
154-
if ($requireReprint) {
155-
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
156-
return $node;
157-
}
158-
159148
return null;
160149
}
161150

0 commit comments

Comments
 (0)