mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-13 06:32:22 +00:00
* 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>
43 lines
1.3 KiB
PHP
43 lines
1.3 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 Symplify\SimplePhpDocParser\PhpDocNodeVisitor\AbstractPhpDocNodeVisitor;
|
|
|
|
final class ParamPhpDocNodeVisitor extends AbstractPhpDocNodeVisitor implements BasePhpDocNodeVisitorInterface
|
|
{
|
|
public function __construct(
|
|
private readonly AttributeMirrorer $attributeMirrorer
|
|
) {
|
|
}
|
|
|
|
public function enterNode(Node $node): ?Node
|
|
{
|
|
if (! $node instanceof ParamTagValueNode) {
|
|
return null;
|
|
}
|
|
|
|
if ($node instanceof VariadicAwareParamTagValueNode) {
|
|
return null;
|
|
}
|
|
|
|
$variadicAwareParamTagValueNode = new VariadicAwareParamTagValueNode(
|
|
$node->type,
|
|
$node->isVariadic,
|
|
$node->parameterName,
|
|
$node->description
|
|
);
|
|
|
|
$this->attributeMirrorer->mirror($node, $variadicAwareParamTagValueNode);
|
|
|
|
return $variadicAwareParamTagValueNode;
|
|
}
|
|
}
|