error_renderer.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Loader\Configurator;
  11. use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
  12. return static function (ContainerConfigurator $container) {
  13. $container->services()
  14. ->set('error_handler.error_renderer.html', HtmlErrorRenderer::class)
  15. ->args([
  16. inline_service()
  17. ->factory([HtmlErrorRenderer::class, 'isDebug'])
  18. ->args([
  19. service('request_stack'),
  20. param('kernel.debug'),
  21. ]),
  22. param('kernel.charset'),
  23. service('debug.file_link_formatter')->nullOnInvalid(),
  24. param('kernel.project_dir'),
  25. inline_service()
  26. ->factory([HtmlErrorRenderer::class, 'getAndCleanOutputBuffer'])
  27. ->args([service('request_stack')]),
  28. service('logger')->nullOnInvalid(),
  29. ])
  30. ->alias('error_renderer.html', 'error_handler.error_renderer.html')
  31. ->alias('error_renderer', 'error_renderer.html')
  32. ;
  33. };