| Subject |
Details |
| Rector version |
v0.5.18 |
| PHP version |
PHP 7.3.3 |
| Full Command |
vendor/bin/rector process --set framework-extra-bundle-50 src |
Current Behaviour
The rector removes the defaults and requirements options from the Route annotation. So it seems to me doing too much work.
---------- begin diff ----------
--- Original
+++ New
@@ -13,15 +13,13 @@
/**
* @param mixed $category
*
- * @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"})
- * @Template("PAPPReportBundle:Report:report_list.html.twig")
- *
+ * @Route("/{category}", name="report_overview")
* @return array
*/
public function indexAction($category = null)
{
- return [
+ return $this->render('PAPPReportBundle:Report:report_list.html.twig', [
'category' => $category,
- ];
+ ]);
}
}
----------- end diff -----------
Minimal PHP Code Causing Issue
<?php
declare(strict_types=1);
namespace PAPP\ReportBundle\Controller\Overview;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
final class TestController
{
/**
* @param mixed $category
*
* @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"})
* @Template("PAPPReportBundle:Report:report_list.html.twig")
*
* @return array
*/
public function indexAction($category = null)
{
return [
'category' => $category,
];
}
}
Expected Behaviour
---------- begin diff ----------
--- Original
+++ New
@@ -13,15 +13,13 @@
/**
* @param mixed $category
*
* @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"})
- * @Template("PAPPReportBundle:Report:report_list.html.twig")
*
* @return array
*/
public function indexAction($category = null)
{
- return [
+ return $this->render('PAPPReportBundle:Report:report_list.html.twig', [
'category' => $category,
- ];
+ ]);
}
}
----------- end diff -----------
Current Behaviour
The rector removes the defaults and requirements options from the Route annotation. So it seems to me doing too much work.
---------- begin diff ---------- --- Original +++ New @@ -13,15 +13,13 @@ /** * @param mixed $category * - * @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"}) - * @Template("PAPPReportBundle:Report:report_list.html.twig") - * + * @Route("/{category}", name="report_overview") * @return array */ public function indexAction($category = null) { - return [ + return $this->render('PAPPReportBundle:Report:report_list.html.twig', [ 'category' => $category, - ]; + ]); } } ----------- end diff -----------Minimal PHP Code Causing Issue
Expected Behaviour
---------- begin diff ---------- --- Original +++ New @@ -13,15 +13,13 @@ /** * @param mixed $category * * @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"}) - * @Template("PAPPReportBundle:Report:report_list.html.twig") * * @return array */ public function indexAction($category = null) { - return [ + return $this->render('PAPPReportBundle:Report:report_list.html.twig', [ 'category' => $category, - ]; + ]); } } ----------- end diff -----------