// call controller
$response =
$controller(...
$arguments);
// view
if (!
$response instanceof Response
) { $event =
new ViewEvent($this,
$request,
$type,
$response,
$event);
$this->dispatcher->
dispatch($event, KernelEvents::VIEW
);
if ($event->
hasResponse()) { $response =
$event->
getResponse();
} else { $msg =
sprintf('The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned %s.',
$this->
varToString($response));
// the user may have forgotten to return something
if (null ===
$response) { $msg .= ' Did you forget to add a return statement somewhere in your controller?';
} throw new ControllerDoesNotReturnResponseException($msg,
$controller, __FILE__, __LINE__ - 17
);
} } return $this->
filterResponse($response,
$request,
$type);
}