Commit 7d6298d8 authored by Damien Walsh's avatar Damien Walsh Committed by Fabien Potencier

Improve exception messages for mount()

parent b0aa888c
...@@ -466,11 +466,17 @@ class Application extends Container implements HttpKernelInterface, TerminableIn ...@@ -466,11 +466,17 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
* @param ControllerCollection|ControllerProviderInterface $controllers A ControllerCollection or a ControllerProviderInterface instance * @param ControllerCollection|ControllerProviderInterface $controllers A ControllerCollection or a ControllerProviderInterface instance
* *
* @return Application * @return Application
*
* @throws \LogicException
*/ */
public function mount($prefix, $controllers) public function mount($prefix, $controllers)
{ {
if ($controllers instanceof ControllerProviderInterface) { if ($controllers instanceof ControllerProviderInterface) {
$controllers = $controllers->connect($this); $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) { if (!$controllers instanceof ControllerCollection) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment