From 8953c00043f49d5b50cbb2c08456dfff6034fb60 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Mon, 11 Sep 2023 16:50:46 +0200 Subject: [PATCH] make use of doc block updater --- .../ClassMethod/DowngradeCovariantReturnTypeRector.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index 8c280620..8c1844c5 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -19,6 +19,7 @@ use PHPStan\Type\ThisType; use PHPStan\Type\Type; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger; +use Rector\Comments\NodeDocBlock\DocBlockUpdater; use Rector\Core\Rector\AbstractRector; use Rector\Core\Reflection\ReflectionResolver; use Rector\Core\Util\Reflection\PrivatesAccessor; @@ -42,7 +43,8 @@ public function __construct( private readonly ReturnTagRemover $returnTagRemover, private readonly ReflectionResolver $reflectionResolver, private readonly PrivatesAccessor $privatesAccessor, - private readonly UnionTypeAnalyzer $unionTypeAnalyzer + private readonly UnionTypeAnalyzer $unionTypeAnalyzer, + private readonly DocBlockUpdater $docBlockUpdater, ) { } @@ -187,6 +189,8 @@ private function addDocBlockReturn(ClassMethod $classMethod): void $this->phpDocTypeChanger->changeReturnType($classMethod, $phpDocInfo, $type); $this->returnTagRemover->removeReturnTagIfUseless($phpDocInfo, $classMethod); + + $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod); } /**