mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 20:23:49 +01:00
35 lines
1.7 KiB
PHP
35 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\BetterPhpDocParser\PhpDocNodeVisitor;
|
|
|
|
use PHPStan\PhpDocParser\Ast\Node;
|
|
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
|
use Rector\BetterPhpDocParser\Attributes\AttributeMirrorer;
|
|
use Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface;
|
|
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode;
|
|
use RectorPrefix20211108\Symplify\SimplePhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
|
final class ParamPhpDocNodeVisitor extends \RectorPrefix20211108\Symplify\SimplePhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor implements \Rector\BetterPhpDocParser\Contract\BasePhpDocNodeVisitorInterface
|
|
{
|
|
/**
|
|
* @var \Rector\BetterPhpDocParser\Attributes\AttributeMirrorer
|
|
*/
|
|
private $attributeMirrorer;
|
|
public function __construct(\Rector\BetterPhpDocParser\Attributes\AttributeMirrorer $attributeMirrorer)
|
|
{
|
|
$this->attributeMirrorer = $attributeMirrorer;
|
|
}
|
|
public function enterNode(\PHPStan\PhpDocParser\Ast\Node $node) : ?\PHPStan\PhpDocParser\Ast\Node
|
|
{
|
|
if (!$node instanceof \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode) {
|
|
return null;
|
|
}
|
|
if ($node instanceof \Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode) {
|
|
return null;
|
|
}
|
|
$variadicAwareParamTagValueNode = new \Rector\BetterPhpDocParser\ValueObject\PhpDoc\VariadicAwareParamTagValueNode($node->type, $node->isVariadic, $node->parameterName, $node->description);
|
|
$this->attributeMirrorer->mirror($node, $variadicAwareParamTagValueNode);
|
|
return $variadicAwareParamTagValueNode;
|
|
}
|
|
}
|