8000 [FrameworkBundle] fix routing descriptor for options · symfony/symfony@b0c29a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0c29a0

Browse files
committed
[FrameworkBundle] fix routing descriptor for options
1 parent 8d07449 commit b0c29a0

File tree

7 files changed

+29
-9
lines changed

7 files changed

+29
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function describeRoute(Route $route, array $options = array())
5656
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
5757
."\n".'- Class: '.get_class($route)
5858
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
59-
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
59+
."\n".'- Requirements: '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM')
6060
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
6161

6262
$this->write(isset($options['name'])

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function describeRoute(Route $route, array $options = array())
7979
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
8080
'<comment>Class</comment> '.get_class($route),
8181
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
82-
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
82+
'<comment>Requirements</comment> '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'),
8383
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
8484
);
8585

@@ -306,6 +306,10 @@ protected function describeContainerParameter($parameter, array $options = array
306306
*/
307307
private function formatRouterConfig(array $array)
3083 8000 08
{
309+
if (!count($array)) {
310+
return 'NONE';
311+
}
312+
309313
$string = '';
310314
ksort($array);
311315
foreach ($array as $name => $value) {

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
- Defaults:
99
- `name`: Joseph
1010
- Requirements:
11-
- `name`: [a-z]+
11+
- `name`: [a-z]+
12+
- Options:
13+
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
14+
- `opt1`: val1
15+
- `opt2`: val2

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<comment>Requirements</comment> name: [a-z]+
1010
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
1111
opt1: val1
12-
opt2: val2
12+
opt2: val2

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
- Method: PUT|POST
77
- Class: Symfony\Component\Routing\Route
88
- Defaults: NONE
9-
- Requirements: NONE
9+
- Requirements: NO CUSTOM
10+
- Options:
11+
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
12+
- `opt1`: val1
13+
- `opt2`: val2

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<comment>Scheme</comment> http|https
66
<comment>Method</comment> PUT|POST
77
<comment>Class</comment> Symfony\Component\Routing\Route
8-
<comment>Defaults</comment>
9-
<comment>Requirements</comment>
8+
<comment>Defaults</comment> NONE
9+
<comment>Requirements</comment> NO CUSTOM
1010
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
1111
opt1: val1
12-
opt2: val2
12+
opt2: val2

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ route_1
1212
- `name`: Joseph
1313
- Requirements:
1414
- `name`: [a-z]+
15+
- Options:
16+
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
17+
- `opt1`: val1
18+
- `opt2`: val2
1519

1620

1721
route_2
@@ -25,4 +29,8 @@ route_2
2529
- Method: PUT|POST
2630
- Class: Symfony\Component\Routing\Route
2731
- Defaults: NONE
28-
- Requirements: NONE
32+
- Requirements: NO CUSTOM
33+
- Options:
34+
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
35+
- `opt1`: val1
36+
- `opt2`: val2

0 commit comments

Comments
 (0)
0