[FrameworkBundle] Add flag to sort `debug:router` output

by @HMRDevil

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/57651/0069780401461f15600156bf1ca5b9f7eb68c81c/cs.diff | patch -p0
diff -ru src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
--- src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php	2024-09-14 14:58:33.802610515 +0000
+++ src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php	2024-09-14 14:58:35.013653134 +0000
@@ -120,7 +120,7 @@
         } else {
             $sortBy = $input->getOption('sort');
             if ($sortBy) {
-                $routes = $this->sortBy($routes, \strtolower($sortBy));
+                $routes = $this->sortBy($routes, strtolower($sortBy));
             }
             $helper->describe($io, $routes, [
                 'format' => $input->getOption('format'),
@@ -185,7 +185,7 @@
         $sortedRoutes = new RouteCollection();
 
         if ('name' === $column) {
-            \ksort($routesArray);
+            ksort($routesArray);
             foreach ($routesArray as $name => $route) {
                 $sortedRoutes->add($name, $route);
                 $sortedRoutes->addAlias($route->getDefault('_controller'), $name);
@@ -198,14 +198,14 @@
 
         if ('method' === $column) {
             foreach ($routesArray as $name => $route) {
-                $methods = empty($route->getMethods()) ? 'ANY' : \implode('|', $route->getMethods());
+                $methods = empty($route->getMethods()) ? 'ANY' : implode('|', $route->getMethods());
                 $helperArray[$methods][$name] = $route;
             }
         }
 
         if ('scheme' === $column) {
             foreach ($routesArray as $name => $route) {
-                $scheme = empty($route->getSchemes()) ? 'ANY' : \implode('|', $route->getSchemes());
+                $scheme = empty($route->getSchemes()) ? 'ANY' : implode('|', $route->getSchemes());
                 $helperArray[$scheme][$name] = $route;
             }
         }
@@ -213,7 +213,6 @@
         if ('host' === $column) {
             foreach ($routesArray as $name => $route) {
                 $helperArray[$route->getHost()][$name] = $route;
-
             }
         }
 
@@ -223,7 +222,7 @@
             }
         }
 
-        \ksort($helperArray);
+        ksort($helperArray);
         foreach ($helperArray as $array) {
             foreach ($array as $name => $route) {
                 $sortedRoutes->add($name, $route);

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages