Skip to content

Commit 7b39357

Browse files
committed
fix extra annotation
1 parent 50db3cb commit 7b39357

3 files changed

Lines changed: 1 addition & 13 deletions

File tree

rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Behat/missed_slashes.php.inc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture\Behat;
44

5-
use Behat\Step\Then;
6-
75
final class MissedSlashes
86
{
97
/**
@@ -20,8 +18,6 @@ final class MissedSlashes
2018

2119
namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture\Behat;
2220

23-
use Behat\Step\Then;
24-
2521
final class MissedSlashes
2622
{
2723
#[\Behat\Step\Then('some message')]

rules/Php80/Rector/Class_/AttributeValueResolver.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Nette\Utils\Strings;
88
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
99
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
10-
use Rector\NodeTypeResolver\Node\AttributeKey;
1110
use Rector\Php80\ValueObject\AnnotationToAttribute;
1211
use Rector\Php80\ValueObject\AttributeValueAndDocComment;
1312
use Rector\Util\NewLineSplitter;
@@ -33,13 +32,7 @@ public function resolve(
3332
if ($phpDocTagNode->value instanceof DoctrineAnnotationTagValueNode) {
3433
$originalContent = (string) $phpDocTagNode->value->getOriginalContent();
3534

36-
if ($docValue === '') {
37-
$attributeComment = (string) $phpDocTagNode->value->getAttribute(AttributeKey::ATTRIBUTE_COMMENT);
38-
39-
if ($originalContent === $attributeComment) {
40-
$docValue = $originalContent;
41-
}
42-
} else {
35+
if ($docValue !== '') {
4336
$attributeComment = ltrim($originalContent, $docValue);
4437
if ($attributeComment !== '') {
4538
$docValue .= "\n" . $attributeComment;

src/PhpParser/Printer/BetterStandardPrinter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PhpParser\Internal\TokenStream;
1010
use PhpParser\Node;
1111
use PhpParser\Node\Arg;
12-
use PhpParser\Node\AttributeGroup;
1312
use PhpParser\Node\Expr;
1413
use PhpParser\Node\Expr\Array_;
1514
use PhpParser\Node\Expr\ArrowFunction;

0 commit comments

Comments
 (0)