Repository: symfony/symfony
File: src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php (PHP)

Code before:
class_exists(ChainAdapter::class);
class_exists(PhpArrayAdapter::class);
class_exists(PhpFilesAdapter::class);
class_exists(Dotenv::class);
class_exists(ErrorHandler::class);
class_exists(Hydrator::class);
class_exists(Registry::class);

/**
 * Bundle.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class FrameworkBundle extends Bundle
{
    public function boot()
    {
        if (class_exists(ErrorHandler::class, false)) {
            $handler = set_error_handler('var_dump');
            restore_error_handler();
        } else {
            $handler = ErrorHandler::register(null, false);
        }

        if (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
            $handler->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
        }

        if ($this->container->getParameter('kernel.http_method_override')) {
            Request::enableHttpMethodParameterOverride();
        }
    }

    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $registerListenersPass = new RegisterListenersPass();
        $registerListenersPass->setHotPathEvents([
            KernelEvents::REQUEST,
            KernelEvents::CONTROLLER,
            KernelEvents::CONTROLLER_ARGUMENTS,
            KernelEvents::RESPONSE,
            KernelEvents::FINISH_REQUEST,
        ]);
        if (class_exists(ConsoleEvents::class)) {
            $registerListenersPass->setNoPreloadEvents([
                ConsoleEvents::COMMAND,
                ConsoleEvents::TERMINATE,
                ConsoleEvents::ERROR,
            ]);

Review comment (bug):
```suggestion
            $handler[0]->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
```

Code after:
class_exists(ArrayAdapter::class);
class_exists(ChainAdapter::class);
class_exists(PhpArrayAdapter::class);
class_exists(PhpFilesAdapter::class);
class_exists(Dotenv::class);
class_exists(ErrorHandler::class);
class_exists(Hydrator::class);
class_exists(Registry::class);

/**
 * Bundle.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class FrameworkBundle extends Bundle
{
    public function boot()
    {
        if (class_exists(SymfonyRuntime::class)) {
            $handler = set_error_handler('var_dump');
            restore_error_handler();
        } else {
            $handler = [ErrorHandler::register(null, false)];
        }

        if (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
            $handler[0]->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
        }

        if ($this->container->getParameter('kernel.http_method_override')) {
            Request::enableHttpMethodParameterOverride();
        }
    }

    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $registerListenersPass = new RegisterListenersPass();
        $registerListenersPass->setHotPathEvents([
            KernelEvents::REQUEST,
            KernelEvents::CONTROLLER,
            KernelEvents::CONTROLLER_ARGUMENTS,
            KernelEvents::RESPONSE,
            KernelEvents::FINISH_REQUEST,
        ]);
        if (class_exists(ConsoleEvents::class)) {
            $registerListenersPass->setNoPreloadEvents([
                ConsoleEvents::COMMAND,
                ConsoleEvents::TERMINATE,
                ConsoleEvents::ERROR,