diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 2b4b7d70c97a..5b4a1b0887a1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -56,7 +56,7 @@ protected function describeRoute(Route $route, array $options = array()) ."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY') ."\n".'- Class: '.get_class($route) ."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults()) - ."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE' + ."\n".'- Requirements: '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM') ."\n".'- Options: '.$this->formatRouterConfig($route->getOptions()); $this->write(isset($options['name']) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index fb506deff903..8bb803e36c65 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -79,7 +79,7 @@ protected function describeRoute(Route $route, array $options = array()) 'Method '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'), 'Class '.get_class($route), 'Defaults '.$this->formatRouterConfig($route->getDefaults()), - 'Requirements '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM', + 'Requirements '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'), 'Options '.$this->formatRouterConfig($route->getOptions()), ); @@ -306,6 +306,10 @@ protected function describeContainerParameter($parameter, array $options = array */ private function formatRouterConfig(array $array) { + if (!count($array)) { + return 'NONE'; + } + $string = ''; ksort($array); foreach ($array as $name => $value) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md index c292438b0a7b..5bb091889b7b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.md @@ -8,4 +8,8 @@ - Defaults: - `name`: Joseph - Requirements: - - `name`: [a-z]+ \ No newline at end of file + - `name`: [a-z]+ +- Options: + - `compiler_class`: Symfony\Component\Routing\RouteCompiler + - `opt1`: val1 + - `opt2`: val2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt index 502dfc462858..d6d2aa38b752 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_1.txt @@ -9,4 +9,4 @@ Requirements name: [a-z]+ Options compiler_class: Symfony\Component\Routing\RouteCompiler opt1: val1 - opt2: val2 \ No newline at end of file + opt2: val2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md index 1cbb0e3004ac..41b185495205 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.md @@ -6,4 +6,8 @@ - Method: PUT|POST - Class: Symfony\Component\Routing\Route - Defaults: NONE -- Requirements: NONE \ No newline at end of file +- Requirements: NO CUSTOM +- Options: + - `compiler_class`: Symfony\Component\Routing\RouteCompiler + - `opt1`: val1 + - `opt2`: val2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt index 96b7a616fe18..8c1a14312392 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.txt @@ -5,8 +5,8 @@ Scheme http|https Method PUT|POST Class Symfony\Component\Routing\Route -Defaults -Requirements +Defaults NONE +Requirements NO CUSTOM Options compiler_class: Symfony\Component\Routing\RouteCompiler opt1: val1 - opt2: val2 \ No newline at end of file + opt2: val2 diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md index 24950b1f577b..a1ae684674ab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.md @@ -12,6 +12,10 @@ route_1 - `name`: Joseph - Requirements: - `name`: [a-z]+ +- Options: + - `compiler_class`: Symfony\Component\Routing\RouteCompiler + - `opt1`: val1 + - `opt2`: val2 route_2 @@ -25,4 +29,8 @@ route_2 - Method: PUT|POST - Class: Symfony\Component\Routing\Route - Defaults: NONE -- Requirements: NONE +- Requirements: NO CUSTOM +- Options: + - `compiler_class`: Symfony\Component\Routing\RouteCompiler + - `opt1`: val1 + - `opt2`: val2