Run Rector on your code to see what it can do for you:

 <?php
 
 namespace Symfony\Component\Routing\Annotation
     
     class Foo
     {
-        /** 
-         * @Route("/some/{id}", defaults={"id" = null})
-         */
-    	public function indexAction()
+        #[Route(path: '/some/{id}', defaults: ['id' => 'null'])]
+        public function indexAction()
         {
         }
     }
 }
PHP snippet to change

Applied Rules:

Not a change you expect?

Config  rector.php
Rector version: 2.1.7 - released at 2025-09-10 06:33