Skip to content

Commit d5d400c

Browse files
committed
Fixing comments from the code review and regenerating expected test output
1 parent b4dfeaa commit d5d400c

15 files changed

+30
-32
lines changed

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
5959
$showAliases = $options['show_aliases'] ?? false;
6060

6161
$tableRows = [];
62-
$shouldShowSchema = false;
62+
$shouldShowScheme = false;
6363
$shouldShowHost = false;
6464
foreach ($routes->all() as $name => $route) {
6565
$controller = $route->getDefault('_controller');
6666

67-
$schema = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
68-
$shouldShowSchema = $shouldShowSchema || 'ANY' !== $schema;
67+
$scheme = $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY';
68+
$shouldShowScheme = $shouldShowScheme || 'ANY' !== $scheme;
6969

7070
$host = '' !== $route->getHost() ? $route->getHost() : 'ANY';
7171
$shouldShowHost = $shouldShowHost || 'ANY' !== $host;
7272

7373
$row = [
7474
'Name' => $name,
7575
'Methods' => $this->formatMethods($route->getMethods()),
76-
'Schema' => $schema,
76+
'Scheme' => $scheme,
7777
'Host' => $host,
7878
'Path' => $route->getPath(),
7979
'Controller' => $controller ? $this->formatControllerLink($controller, $this->formatCallable($controller), $options['container'] ?? null) : '',
@@ -88,20 +88,16 @@ protected function describeRouteCollection(RouteCollection $routes, array $optio
8888

8989
$tableHeaders = ['Name', 'Method'];
9090

91-
if ($shouldShowSchema) {
92-
$tableHeaders[] = 'Schema';
91+
if ($shouldShowScheme) {
92+
$tableHeaders[] = 'Scheme';
9393
} else {
94-
array_walk($tableRows, function (&$row) {
95-
unset($row['Schema']);
96-
});
94+
array_walk($tableRows, function (&$row) { unset($row['Scheme']); });
9795
}
9896

9997
if ($shouldShowHost) {
10098
$tableHeaders[] = 'Host';
10199
} else {
102-
array_walk($tableRows, function (&$row) {
103-
unset($row['Host']);
104-
});
100+
array_walk($tableRows, function (&$row) { unset($row['Host']); });
105101
}
106102

107103
$tableHeaders = array_merge($tableHeaders, ['Path', 'Controller']);
@@ -616,10 +612,7 @@ private function formatMethods(array $methods): string
616612
$methods = ['ANY'];
617613
}
618614

619-
return implode('|', array_map(
620-
fn (string $method): string => '<fg='.self::VERB_COLORS[$method].'>'.$method.'</>',
621-
$methods
622-
));
615+
return implode('|', array_map(fn (string $method): string => '<fg='.self::VERB_COLORS[$method].'>'.$method.'</>', $methods));
623616
}
624617

625618
private function formatControllerLink(mixed $controller, string $anchorText, ?callable $getContainer = null): string

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public static function getRouteCollections()
4444
['https'],
4545
));
4646

47-
$routesWithGenericSchema = new RouteCollection();
48-
$routesWithGenericSchema->add('some_route_with_host', new RouteStub(
47+
$routesWithGenericScheme = new RouteCollection();
48+
$routesWithGenericScheme->add('some_route_with_host', new RouteStub(
4949
'/some-route',
5050
['_controller' => 'strpos'],
5151
[],
@@ -58,7 +58,7 @@ public static function getRouteCollections()
5858
'empty_route_collection' => new RouteCollection(),
5959
'route_collection_1' => $collection1,
6060
'route_with_generic_host' => $routesWithGenericHost,
61-
'route_with_generic_schema' => $routesWithGenericSchema,
61+
'route_with_generic_scheme' => $routesWithGenericScheme,
6262
];
6363
}
6464

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
[]
1+
[]
2+
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<routes/>
2+
<routes/>
3+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@
3636
},
3737
"condition": "context.getMethod() in ['GET', 'HEAD', 'POST']"
3838
}
39-
}
39+
}
40+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--------- ---------- ------------ ----------- --------------- ------------
2-
 Name   Method   Schema   Host   Path   Controller 
2+
 Name   Method   Scheme   Host   Path   Controller 
33
--------- ---------- ------------ ----------- --------------- ------------
44
route_1 GET|HEAD http|https localhost /hello/{name}
55
route_2 PUT|POST http|https localhost /name/add

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@
3333
</options>
3434
<condition>context.getMethod() in ['GET', 'HEAD', 'POST']</condition>
3535
</route>
36-
</routes>
36+
</routes>
37+

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
 Name   Method   Scheme   Host   Path   Controller 
33
--------- ---------- ------------ ----------- --------------- ------------
44
route_1 GET|HEAD http|https localhost /hello/{name}
5-
route_3 ANY http|https localhost /other/route
5+
route_3 ANY http|https localhost /other/route
66
--------- ---------- ------------ ----------- --------------- ------------
77

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--------- ---------- ------------ ----------- -----------
2-
 Name   Method   Scheme   Host   Path 
3-
--------- ---------- ------------ ----------- -----------
4-
route_2 PUT|POST http|https localhost /name/add
5-
--------- ---------- ------------ ----------- -----------
1+
--------- ---------- ------------ ----------- ----------- ------------
2+
 Name   Method   Scheme   Host   Path   Controller 
3+
--------- ---------- ------------ ----------- ----------- ------------
4+
route_2 PUT|POST http|https localhost /name/add
5+
--------- ---------- ------------ ----------- ----------- ------------
66

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_with_generic_host.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
------------ -------- -------- ------------- --------------
2-
 Name   Method   Schema   Path   Controller 
2+
 Name   Method   Scheme   Path   Controller 
33
------------ -------- -------- ------------- --------------
44
some_route ANY https /some-route Controller()
55
------------ -------- -------- ------------- --------------

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_with_generic_host.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
<option key="compiler_class">Symfony\Component\Routing\RouteCompiler</option>
1111
</options>
1212
</route>
13-
</routes>
13+
</routes>
14+

0 commit comments

Comments
 (0)