Find a Rector rule

Find the best Rector rule to solve your problem. Searching through 1005 rules.

Found 4 rules, grouped by set: Clear

symfony/routing 4 matches

Replace regex string in #[Route] requirements with a Requirement constant

 use Symfony\Component\Routing\Attribute\Route;
+use Symfony\Component\Routing\Requirement\Requirement;

 final class SomeController
 {
     #[Route('/detail/{id}', requirements: [
-        'id' => '[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}',
+        'id' => Requirement::UUID_V4,
     ])]
     public function detail()
     {
     }
 }

Merge removed @Method annotation to @Route one

-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
 use Symfony\Component\Routing\Annotation\Route;

 class DefaultController extends Controller
 {
     /**
-     * @Route("/show/{id}")
-     * @Method({"GET", "HEAD"})
+     * @Route("/show/{id}", methods={"GET","HEAD"})
      */
     public function show($id)
     {
     }
 }

Replace Sensio @Route annotation with Symfony one

-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Symfony\Component\Routing\Annotation\Route;

 final class SomeClass
 {
     /**
      * @Route()
      */
     public function run()
     {
     }
 }

Remove service from Sensio @Route

 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

 final class SomeClass
 {
     /**
-     * @Route(service="some_service")
+     * @Route()
      */
     public function run()
     {
     }
 }