Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert reprint same line on DowngradeAttributeToAnnotationRector #249

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Rector\Contract\Rector\ConfigurableRectorInterface;
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
use Rector\NodeFactory\DoctrineAnnotationFactory;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
Expand Down Expand Up @@ -106,14 +105,9 @@ public function refactor(Node $node): ?Node
$this->isDowngraded = false;

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

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

if (! $this->isDowngraded) {
if ($requireReprint) {
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
return $node;
}

return null;
}

Expand Down
Loading