Skip to content

Commit

Permalink
Merge pull request #7984 from codeigniter4/dependabot/composer/rector…
Browse files Browse the repository at this point in the history
…/rector-0.18.4

build(deps-dev): update rector/rector requirement from 0.18.3 to 0.18.4
  • Loading branch information
samsonasik authored Sep 26, 2023
2 parents da0bddf + 8eaba9b commit e1c2f5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"phpunit/phpcov": "^8.2",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0",
"rector/rector": "0.18.3",
"rector/rector": "0.18.4",
"vimeo/psalm": "^5.0"
},
"suggest": {
Expand Down
13 changes: 13 additions & 0 deletions utils/Rector/RemoveVarTagFromClassConstantRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassConst;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

final class RemoveVarTagFromClassConstantRector extends AbstractRector
{
private PhpDocInfoFactory $phpDocInfoFactory;
private DocBlockUpdater $docBlockUpdater;

public function __construct(PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater)
{
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->docBlockUpdater = $docBlockUpdater;
}

public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Remove @var tag from class constant', [
Expand Down Expand Up @@ -64,6 +75,8 @@ public function refactor(Node $node): ?Node

$phpDocInfo->removeByType(VarTagValueNode::class);

$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);

return $node;
}
}

0 comments on commit e1c2f5d

Please sign in to comment.