Skip to content

Commit 3265f88

Browse files
committed
[FrameworkBundle] Improve error message in MicroKernelTrait when using deprecated configureRoutes(RouteCollectionBuilder) with symfony/routing >= 6.0
1 parent 7fc16c5 commit 3265f88

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Kernel/MicroKernelTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
213213
if ($configuratorClass && !is_a(RoutingConfigurator::class, $configuratorClass, true)) {
214214
trigger_deprecation('symfony/framework-bundle', '5.1', 'Using type "%s" for argument 1 of method "%s:configureRoutes()" is deprecated, use "%s" instead.', RouteCollectionBuilder::class, self::class, RoutingConfigurator::class);
215215

216+
if (!class_exists(RouteCollectionBuilder::class)) {
217+
throw new \InvalidArgumentException(sprintf('Using type "%s" for argument 1 of method "%s:configureRoutes()" is not compatible with the installed "symfony/routing" version. Use "%s" instead, or run "composer require symfony/routing:^5.4".', RouteCollectionBuilder::class, self::class, RoutingConfigurator::class));
218+
}
219+
216220
$routes = new RouteCollectionBuilder($loader);
217221
$this->configureRoutes($routes);
218222

0 commit comments

Comments
 (0)