mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 01:40:49 +00:00
fc10fce13d
* re-enable rectify and ecs * [Rectify] [Php81] Enable Rectify on Readonly Property only * comment * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
32 lines
970 B
PHP
32 lines
970 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer;
|
|
|
|
use PhpParser\Node;
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
|
use Rector\NodeTypeResolver\PhpDoc\PhpDocNodeTraverser\ImportingPhpDocNodeTraverserFactory;
|
|
use Rector\NodeTypeResolver\PhpDocNodeVisitor\NameImportingPhpDocNodeVisitor;
|
|
|
|
final class DocBlockNameImporter
|
|
{
|
|
public function __construct(
|
|
private readonly NameImportingPhpDocNodeVisitor $nameImportingPhpDocNodeVisitor,
|
|
private readonly ImportingPhpDocNodeTraverserFactory $importingPhpDocNodeTraverserFactory
|
|
) {
|
|
}
|
|
|
|
public function importNames(PhpDocNode $phpDocNode, Node $node): void
|
|
{
|
|
if ($phpDocNode->children === []) {
|
|
return;
|
|
}
|
|
|
|
$this->nameImportingPhpDocNodeVisitor->setCurrentNode($node);
|
|
|
|
$phpDocNodeTraverser = $this->importingPhpDocNodeTraverserFactory->create();
|
|
$phpDocNodeTraverser->traverse($phpDocNode);
|
|
}
|
|
}
|