Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65bf924

Browse files
author
Jelte Steijaert
committed
Bug #16343 [Router] Too many Routes ?
1 parent e2022ce commit 65bf924

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public function dump(array $options = array())
3838
'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
3939
), $options);
4040

41-
return <<<EOF
41+
if (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700) {
42+
return <<<EOF
4243
<?php
4344
4445
use Symfony\Component\Routing\RequestContext;
@@ -53,7 +54,7 @@ public function dump(array $options = array())
5354
*/
5455
class {$options['class']} extends {$options['base_class']}
5556
{
56-
private static \$declaredRoutes = {$this->generateDeclaredRoutes()};
57+
private static \$declaredRoutes;
5758
5859
/**
5960
* Constructor.
@@ -62,11 +63,44 @@ public function __construct(RequestContext \$context, LoggerInterface \$logger =
6263
{
6364
\$this->context = \$context;
6465
\$this->logger = \$logger;
66+
self::\$declaredRoutes = {$this->generateDeclaredRoutes()};
6567
}
6668
6769
{$this->generateGenerateMethod()}
6870
}
6971
72+
EOF;
73+
}
74+
75+
return <<<EOF
76+
<?php
77+
78+
use Symfony\Component\Routing\RequestContext;
79+
use Symfony\Component\Routing\Exception\RouteNotFoundException;
80+
use Psr\Log\LoggerInterface;
81+
82+
/**
83+
* {$options['class']}
84+
*
85+
* This class has been auto-generated
86+
* by the Symfony Routing Component.
87+
*/
88+
class {$options['class']} extends {$options['base_class']}
89+
{
90+
private static \$declaredRoutes = {$this->generateDeclaredRoutes()};;
91+
92+
/**
93+
* Constructor.
94+
*/
95+
public function __construct(RequestContext \$context, LoggerInterface \$logger = null)
96+
{
97+
\$this->context = \$context;
98+
\$this->logger = \$logger;
99+
}
100+
101+
{$this->generateGenerateMethod()}
102+
}
103+
70104
EOF;
71105
}
72106

0 commit comments

Comments
 (0)