minor #37205 [Framework] Convert config/error_renderer.xml to php (benji07)

This PR was merged into the 5.2-dev branch.

Discussion
----------

[Framework] Convert config/error_renderer.xml to php

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Ref #37186
| License       | MIT

Commits
-------

213091e8d2 [Framework] Convert config/error_renderer.xml to php
This commit is contained in:
Fabien Potencier 2020-06-11 13:17:38 +02:00
commit 263d54fc70
3 changed files with 39 additions and 32 deletions

View File

@ -176,7 +176,7 @@ class FrameworkExtension extends Extension
$loader->load('web.xml');
$loader->load('services.xml');
$loader->load('fragment_renderer.xml');
$loader->load('error_renderer.xml');
$phpLoader->load('error_renderer.php');
if (interface_exists(PsrEventDispatcherInterface::class)) {
$container->setAlias(PsrEventDispatcherInterface::class, 'event_dispatcher');

View File

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
return static function (ContainerConfigurator $container) {
$container->services()
->set('error_handler.error_renderer.html', HtmlErrorRenderer::class)
->args([
inline_service()
->factory([HtmlErrorRenderer::class, 'isDebug'])
->args([
service('request_stack'),
param('kernel.debug'),
]),
param('kernel.charset'),
service('debug.file_link_formatter')->nullOnInvalid(),
param('kernel.project_dir'),
inline_service()
->factory([HtmlErrorRenderer::class, 'getAndCleanOutputBuffer'])
->args([service('request_stack')]),
service('logger')->nullOnInvalid(),
])
->alias('error_renderer.html', 'error_handler.error_renderer.html')
->alias('error_renderer', 'error_renderer.html')
;
};

View File

@ -1,31 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="error_handler.error_renderer.html" class="Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer">
<argument type="service">
<service>
<factory class="Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer" method="isDebug" />
<argument type="service" id="request_stack" />
<argument>%kernel.debug%</argument>
</service>
</argument>
<argument>%kernel.charset%</argument>
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
<argument>%kernel.project_dir%</argument>
<argument type="service">
<service>
<factory class="Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer" method="getAndCleanOutputBuffer" />
<argument type="service" id="request_stack" />
</service>
</argument>
<argument type="service" id="logger" on-invalid="null" />
</service>
<service id="error_renderer.html" alias="error_handler.error_renderer.html" />
<service id="error_renderer" alias="error_renderer.html" />
</services>
</container>