From caaad2c61864df874c1edc39021e690942a5267b Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 18 Sep 2016 10:12:09 +0000 Subject: [PATCH 1/3] test container type --- src/Symfony/Component/HttpKernel/Kernel.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index c6586c02312aa..3f3acfff56a35 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -672,10 +672,16 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container * * @param ContainerInterface $container The service container * + * @throws \DomainException If the container is not of type ContainerBuilder + * * @return DelegatingLoader The loader */ protected function getContainerLoader(ContainerInterface $container) { + if (!$container instanceof ContainerBuilder) { + throw new \DomainException(sprintf('Container must be an instance of Symfony\Component\DependencyInjection\ContainerBuilder, got %s', get_class($container))); + } + $locator = new FileLocator($this); $resolver = new LoaderResolver(array( new XmlFileLoader($container, $locator), From 6bff28cb0cd631e59cbbfdcaa37751a39a063b0f Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Sun, 18 Sep 2016 14:56:29 +0000 Subject: [PATCH 2/3] consistent exception --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 3f3acfff56a35..29cbb0a6766bc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -672,14 +672,14 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container * * @param ContainerInterface $container The service container * - * @throws \DomainException If the container is not of type ContainerBuilder + * @throws \InvalidArgumentException When the container is not an instance of ContainerBuilder * * @return DelegatingLoader The loader */ protected function getContainerLoader(ContainerInterface $container) { if (!$container instanceof ContainerBuilder) { - throw new \DomainException(sprintf('Container must be an instance of Symfony\Component\DependencyInjection\ContainerBuilder, got %s', get_class($container))); + throw new \InvalidArgumentException(sprintf('The container must be an instance of Symfony\Component\DependencyInjection\ContainerBuilder, got %s.', get_class($container))); } $locator = new FileLocator($this); From 46d6e4b5f7d231ad6c845eec12b32b523ce4f589 Mon Sep 17 00:00:00 2001 From: Roland Franssen Date: Mon, 19 Sep 2016 12:53:38 +0200 Subject: [PATCH 3/3] @throws after @return --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 29cbb0a6766bc..6936342ae6829 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -672,9 +672,9 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container * * @param ContainerInterface $container The service container * - * @throws \InvalidArgumentException When the container is not an instance of ContainerBuilder - * * @return DelegatingLoader The loader + * + * @throws \InvalidArgumentException When the container is not an instance of ContainerBuilder */ protected function getContainerLoader(ContainerInterface $container) {