Find the best Rector rule to solve your problem


Configurable

ArgumentRemoverRector

Removes defined arguments in defined methods and their calls.

 $someObject = new SomeClass;
-$someObject->someMethod(true);
+$someObject->someMethod();

ContainerGetNameToTypeInTestsRector

Change $container->get("some_name") to bare type, useful since Symfony 3.4

 use PHPUnit\Framework\TestCase;

 final class SomeTest extends TestCase
 {
     public function run()
     {
         $container = $this->getContainer();
-        $someClass = $container->get('some_name');
+        $someClass = $container->get(SomeType::class);
     }
 }

MergeMethodAnnotationToRouteAnnotationRector

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)
     {
     }
 }
SETS:  symfony/* 3.4

ReplaceSensioRouteAnnotationWithSymfonyRector

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()
     {
     }
 }
SETS:  symfony/* 3.4

RemoveServiceFromSensioRouteRector

Remove service from Sensio @Route

 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

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