[SYMFONY26] RedirectToRouteRector
gander opened this issue · 2 comments
gander commented
Code example:
public function index(): RedirectResponse
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
return $this->redirect($routeBuilder->setController(ExampleCrudController::class)->generateUrl());
}
Rector want change this:
---------- begin diff ----------
@@ @@
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
- return $this->redirect($routeBuilder->setController(ExampleCrudController::class)->generateUrl());
+ return $this->redirectToRoute(null);
}
public function configureDashboard(): Dashboard
----------- end diff -----------
Applied rules:
* RedirectToRouteRector
But this is ok:
public function index(): RedirectResponse
{
$routeBuilder = $this->get(AdminUrlGenerator::class);
$routeUrl = $routeBuilder->setController(ExampleCrudController::class)->generateUrl();
return $this->redirect($routeUrl);
}
I'll try to work out a solution, bugfix.
johanadivare commented
Yes you can add a test fixture for this rector rule
gander commented
I really haven't had time to do more with it yet. Just enough to report it.