rector-phpunit icon indicating copy to clipboard operation
rector-phpunit copied to clipboard

AnnotationWithValueToAttributeRector not applied due to DoctrineAnnotationTagValueNode

Open mfn opened this issue 2 years ago • 0 comments

Hi,

I noticed some @group … directives not being adapted and after a bit debugging I notice that in \Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector::refactor the call to getTagsByName returned DoctrineAnnotationTagValueNode instead of GenericTagValueNode.

But there is this check which makes it not pass:

if (!$desiredTagValueNode->value instanceof GenericTagValueNode) {
    continue;
}

As to why: well, I've a (namespaces) class \Project\Models\Group imported in some tests and I guess rector treats the class Group special with @group. However, in my case there's no relation here and since the default config in annotations-to-attributes.php uses the FQCN anyway, there's no clash.

What can I do to still have such @group being converted?

I'm talking about using this in CI, so I'm not looking for a one-time transformation here.

Thanks

mfn avatar Dec 12 '23 13:12 mfn