This Symfony command can help you identify mismatched routes. For example, if you migrate the route configuration from YAML to Annotation and the routes do not work correctly afterwards.
One reason why the routes do not work correctly could be that the controller methods are not in the correct order like the YAML configuration was.
Just copy the RouterMismatchCommand.php
into your project and execute it. If you have a mismatched route it will display it in a table.
For me it was sufficient to move the controller method with the route app_foo_staticroute
before the method with the route app_foo_paramroute
. If you're using Symfony >=5.1 you can use the priority
parameter.