PhpDocInfoFactory does not find any annotations anymore #8312
-
Bug Report
Minimal PHP Code Causing Issuegit clone https://github.com/FriendsOfShopware/shopware-rector
cd shopware-rector
composer update
./vendor/bin/phpunit The tests are failing with 0.18.8, as it cannot find the Annotations: Rector: https://github.com/FriendsOfShopware/shopware-rector/blob/main/src/Rule/v65/MigrateCaptchaAnnotationToRouteRector.php#L72-L76 Expected BehaviourTests are green as like the Rector version before |
Beta Was this translation helpful? Give feedback.
Answered by
samsonasik
Nov 16, 2023
Replies: 1 comment 3 replies
-
You need to use diff --git a/src/Rule/v65/MigrateCaptchaAnnotationToRouteRector.php b/src/Rule/v65/MigrateCaptchaAnnotationToRouteRector.php
index fd9db4b..00809f6 100644
--- a/src/Rule/v65/MigrateCaptchaAnnotationToRouteRector.php
+++ b/src/Rule/v65/MigrateCaptchaAnnotationToRouteRector.php
@@ -12,13 +12,17 @@ use Rector\BetterPhpDocParser\PhpDoc\StringNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
+use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
class MigrateCaptchaAnnotationToRouteRector extends AbstractRector
{
- public function __construct(private PhpDocTagRemover $phpDocTagRemover, private PhpDocInfoFactory $phpDocFactory)
+ public function __construct(
+ private PhpDocTagRemover $phpDocTagRemover, private PhpDocInfoFactory $phpDocFactory,
+ private readonly DocBlockUpdater $docBlockUpdater
+ )
{
}
@@ -101,6 +105,8 @@ class MigrateCaptchaAnnotationToRouteRector extends AbstractRector
$this->phpDocTagRemover->removeByName($phpDocInfo, 'Captcha');
+ $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
+
return $node; |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
samsonasik
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to use
Rector\Comments\NodeDocBlock\DocBlockUpdater
service to refresh node before return `$node: