23
23
use Symfony \Component \Routing \Generator \ConfigurableRequirementsInterface ;
24
24
use Symfony \Component \Routing \Generator \Dumper \CompiledUrlGeneratorDumper ;
25
25
use Symfony \Component \Routing \Generator \Dumper \GeneratorDumperInterface ;
26
+ use Symfony \Component \Routing \Generator \Dumper \PhpGeneratorDumper ;
26
27
use Symfony \Component \Routing \Generator \UrlGenerator ;
27
28
use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
28
29
use Symfony \Component \Routing \Matcher \CompiledUrlMatcher ;
29
30
use Symfony \Component \Routing \Matcher \Dumper \CompiledUrlMatcherDumper ;
30
31
use Symfony \Component \Routing \Matcher \Dumper \MatcherDumperInterface ;
32
+ use Symfony \Component \Routing \Matcher \Dumper \PhpMatcherDumper ;
31
33
use Symfony \Component \Routing \Matcher \RequestMatcherInterface ;
32
34
use Symfony \Component \Routing \Matcher \UrlMatcher ;
33
35
use Symfony \Component \Routing \Matcher \UrlMatcherInterface ;
@@ -388,6 +390,11 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
388
390
*/
389
391
protected function getGeneratorDumperInstance ()
390
392
{
393
+ // For BC, fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other
394
+ if (is_a ($ this ->options ['generator_class ' ], CompiledUrlGenerator::class, true ) !== is_a ($ this ->options ['generator_dumper_class ' ], CompiledUrlGeneratorDumper::class, true )) {
395
+ return new PhpGeneratorDumper ($ this ->getRouteCollection ());
396
+ }
397
+
391
398
return new $ this ->options ['generator_dumper_class ' ]($ this ->getRouteCollection ());
392
399
}
393
400
@@ -396,6 +403,11 @@ protected function getGeneratorDumperInstance()
396
403
*/
397
404
protected function getMatcherDumperInstance ()
398
405
{
406
+ // For BC, fallback to PhpMatcherDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other
407
+ if (is_a ($ this ->options ['matcher_class ' ], CompiledUrlMatcher::class, true ) !== is_a ($ this ->options ['matcher_dumper_class ' ], CompiledUrlMatcherDumper::class, true )) {
408
+ return new PhpMatcherDumper ($ this ->getRouteCollection ());
409
+ }
410
+
399
411
return new $ this ->options ['matcher_dumper_class ' ]($ this ->getRouteCollection ());
400
412
}
401
413
0 commit comments