From 902adadbe46ba965732bfb832fa7b8f3e704d2b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:20:24 +0000 Subject: [PATCH 1/2] build(deps-dev): update rector/rector requirement from 0.18.3 to 0.18.4 Updates the requirements on [rector/rector](https://github.com/rectorphp/rector) to permit the latest version. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.3...0.18.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2258eca9ac4d..27e77b515910 100644 --- a/composer.json +++ b/composer.json @@ -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": { From 8eaba9b0c4532ace584cbc49114ca48d481dc42c Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 26 Sep 2023 22:40:57 +0700 Subject: [PATCH 2/2] Fix dependency set --- .../Rector/RemoveVarTagFromClassConstantRector.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/utils/Rector/RemoveVarTagFromClassConstantRector.php b/utils/Rector/RemoveVarTagFromClassConstantRector.php index d780c8647cbd..2393516f508b 100644 --- a/utils/Rector/RemoveVarTagFromClassConstantRector.php +++ b/utils/Rector/RemoveVarTagFromClassConstantRector.php @@ -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', [ @@ -64,6 +75,8 @@ public function refactor(Node $node): ?Node $phpDocInfo->removeByType(VarTagValueNode::class); + $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); + return $node; } }