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
RouteRequirementStringToConstantRector
symfony/routing >=6.1
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()
{
}
}
MergeMethodAnnotationToRouteAnnotationRector
symfony/routing >=3.4
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)
{
}
}
ReplaceSensioRouteAnnotationWithSymfonyRector
symfony/routing >=3.4
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()
{
}
}
RemoveServiceFromSensioRouteRector
symfony/routing >=3.4
Remove service from Sensio @Route
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
final class SomeClass
{
/**
- * @Route(service="some_service")
+ * @Route()
*/
public function run()
{
}
}