Configurable

PhpUnitTestAnnotationToAttributeRector

Convert PHPUnit test metadata annotations to attributes (backward-compatible: keeps the annotation while a supported older version remains).

 /**
  * @group example
  */
+#[\PHPUnit\Framework\Attributes\Group('example')]
 public function testThing(): void {}

Configure your rector.php:

<?php

use DrupalRector\Rector\PHPUnit\PhpUnitTestAnnotationToAttributeRector;
use DrupalRector\Rector\PHPUnit\ValueObject\PhpUnitTestAnnotationToAttributeConfiguration;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(PhpUnitTestAnnotationToAttributeRector::class, [
        new PhpUnitTestAnnotationToAttributeConfiguration('11.0.0', '12.0.0', 'group', 'PHPUnit\Framework\Attributes\Group'),
    ]);