From 7d6298d8bded98d7abdf308e2e784769c5d79780 Mon Sep 17 00:00:00 2001 From: Damien Walsh Date: Mon, 12 May 2014 15:58:58 +0100 Subject: [PATCH] Improve exception messages for mount() --- src/Silex/Application.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Silex/Application.php b/src/Silex/Application.php index ef3070ec2..3c32eef88 100644 --- a/src/Silex/Application.php +++ b/src/Silex/Application.php @@ -466,11 +466,17 @@ public function sendFile($file, $status = 200, array $headers = array(), $conten * @param ControllerCollection|ControllerProviderInterface $controllers A ControllerCollection or a ControllerProviderInterface instance * * @return Application + * + * @throws \LogicException */ public function mount($prefix, $controllers) { if ($controllers instanceof ControllerProviderInterface) { $controllers = $controllers->connect($this); + + if (!$controllers instanceof ControllerCollection) { + throw new \LogicException('The "connect" method of the ControllerProviderInterface must return a ControllerCollection.'); + } } if (!$controllers instanceof ControllerCollection) {