AddRouteAnnotationRector

Collect routes from Symfony project router and add Route annotation to controller action

 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\Routing\Annotation\Route;

 final class SomeController extends AbstractController
 {
+    /**
+     * @Route(name="homepage", path="/welcome")
+     */
     public function index()
     {
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector;

return RectorConfig::configure()
    ->withRules([
        AddRouteAnnotationRector::class,
    ]);