From 6986394042f83bcace33d2fdaf88556057589029 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Sun, 15 Dec 2019 18:41:18 +0100 Subject: [PATCH] [FrameworkBundle][ContainerLintCommand] Improve messages when the kernel or the container is not supported --- .../Bundle/FrameworkBundle/Command/ContainerLintCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php index 1f4ffe59af..5e6277567e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerLintCommand.php @@ -80,7 +80,7 @@ final class ContainerLintCommand extends Command if (!$kernel->isDebug() || !(new ConfigCache($kernelContainer->getParameter('debug.container.dump'), true))->isFresh()) { if (!$kernel instanceof Kernel) { - throw new RuntimeException("This command does not support the console application's kernel."); + throw new RuntimeException(sprintf('This command does not support the application kernel: "%s" does not extend "%s".', \get_class($kernel), Kernel::class)); } $buildContainer = \Closure::bind(function (): ContainerBuilder { @@ -93,7 +93,7 @@ final class ContainerLintCommand extends Command $skippedIds = []; } else { if (!$kernelContainer instanceof Container) { - throw new RuntimeException("This command does not support the console application kernel's container."); + throw new RuntimeException(sprintf('This command does not support the application container: "%s" does not extend "%s".', \get_class($kernelContainer), Container::class)); } (new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernelContainer->getParameter('debug.container.dump'));