public function onKernelView(GetResponseForControllerResultEvent $event)
    {
        $response = $event->getControllerResult();

        if (!(
            null === $response
            || is_array($response)
            || $response instanceof Response
            || (is_object($response) && !method_exists($response, '__toString'))
        )) {
            $event->setResponse(new Response((string) $response));
        }
    }
public function onKernelView(GetResponseForControllerResultEvent $event)
    {
        $response = $event->getControllerResult();

        if (!(
            null === $response
            || is_array($response)
            || $response instanceof Response
            || (is_object($response) && !method_exists($response, '__toString'))
        )) {
            $event->setResponse(new Response((string) $response));
        }
    }
public function onKernelView ( GetResponseForControllerResultEvent $ event ) { $ response = $ event -> getControllerResult ( ) ; if ( ! ( null === $ response || is_array ( $ response ) || $ response instanceof Response || ( is_object ( $ response ) && ! method_exists ( $ response , '__toString' ) ) ) ) { $ event -> setResponse ( new Response ( ( string ) $ response ) ) ; } }
Handles string responses.

@param GetResponseForControllerResultEvent $event The event to handle
Handles string responses .