Skip to content

Commit

Permalink
make use of findDoctrineAnnotationsByClass()
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 1, 2023
1 parent 4a37795 commit 24ea3ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
Expand All @@ -32,7 +31,6 @@ public function __construct(
private readonly PhpDocTagRemover $phpDocTagRemover,
private readonly DocBlockUpdater $docBlockUpdater,
private readonly PhpDocInfoFactory $phpDocInfoFactory,
private readonly PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder,
) {
}

Expand Down Expand Up @@ -104,10 +102,7 @@ public function refactor(Node $node): ?Node
}

// get all routes
$symfonyDoctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass(
$phpDocInfo->getPhpDocNode(),
SymfonyAnnotation::ROUTE
);
$symfonyDoctrineAnnotationTagValueNodes = $phpDocInfo->findByAnnotationClass(SymfonyAnnotation::ROUTE);

// no symfony route? skip it
if ($symfonyDoctrineAnnotationTagValueNodes === []) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\BetterPhpDocParser\PhpDocNodeFinder\PhpDocNodeByTypeFinder;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Configuration\RenamedClassesDataCollector;
use Rector\Core\Rector\AbstractRector;
Expand All @@ -39,7 +38,6 @@ public function __construct(
private readonly PhpDocTagRemover $phpDocTagRemover,
private readonly RenamedClassesDataCollector $renamedClassesDataCollector,
private readonly DocBlockUpdater $docBlockUpdater,
private readonly PhpDocNodeByTypeFinder $phpDocNodeByTypeFinder,
private readonly PhpDocInfoFactory $phpDocInfoFactory,
) {
}
Expand Down Expand Up @@ -105,10 +103,7 @@ public function refactor(Node $node): ?Node
return null;
}

$sensioDoctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass(
$phpDocInfo->getPhpDocNode(),
self::SENSIO_ROUTE_NAME
);
$sensioDoctrineAnnotationTagValueNodes = $phpDocInfo->findByAnnotationClass(self::SENSIO_ROUTE_NAME);

// nothing to find
if ($sensioDoctrineAnnotationTagValueNodes === []) {
Expand Down

0 comments on commit 24ea3ec

Please sign in to comment.