Skip to content

Commit

Permalink
feature #32470 Rename ErrorCatcher to ErrorRenderer (rendering part o…
Browse files Browse the repository at this point in the history
…nly) (yceruto)

This PR was squashed before being merged into the 4.4 branch (closes #32470).

Discussion
----------

Rename ErrorCatcher to ErrorRenderer (rendering part only)

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Follow up #32377

Commits
-------

fb5b042 Rename ErrorCatcher to ErrorRenderer (rendering part only)
  • Loading branch information
nicolas-grekas committed Jul 11, 2019
2 parents 2e5a8c8 + fb5b042 commit 4499e2a
Show file tree
Hide file tree
Showing 51 changed files with 151 additions and 150 deletions.
Expand Up @@ -154,7 +154,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('web.xml');
$loader->load('services.xml');
$loader->load('fragment_renderer.xml');
$loader->load('error_catcher.xml');
$loader->load('error_renderer.xml');

if (interface_exists(PsrEventDispatcherInterface::class)) {
$container->setAlias(PsrEventDispatcherInterface::class, 'event_dispatcher');
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
Expand Up @@ -33,7 +33,7 @@
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\ErrorCatcher\DependencyInjection\ErrorCatcherPass;
use Symfony\Component\ErrorRenderer\DependencyInjection\ErrorRendererPass;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\Form\DependencyInjection\FormPass;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -91,7 +91,7 @@ public function build(ContainerBuilder $container)
KernelEvents::FINISH_REQUEST,
];

$container->addCompilerPass(new ErrorCatcherPass());
$container->addCompilerPass(new ErrorRendererPass());
$container->addCompilerPass(new LoggerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());
$container->addCompilerPass(new RemoveEmptyControllerArgumentLocatorsPass(), PassConfig::TYPE_BEFORE_REMOVING);
Expand Down
Expand Up @@ -22,7 +22,7 @@
<argument type="service" id="debug.file_link_formatter" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
<argument type="service" id="error_catcher.error_formatter" on-invalid="null" />
<argument type="service" id="error_renderer" on-invalid="null" />
</service>

<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
Expand Down

This file was deleted.

@@ -0,0 +1,37 @@
<?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_renderer" class="Symfony\Component\ErrorRenderer\DependencyInjection\LazyLoadingErrorRenderer">
<argument /> <!-- error renderer locator -->
</service>

<service id="error_renderer.renderer.html" class="Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer">
<tag name="error_renderer.renderer" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
<argument>%debug.file_link_format%</argument>
</service>

<service id="error_renderer.renderer.json" class="Symfony\Component\ErrorRenderer\ErrorRenderer\JsonErrorRenderer">
<tag name="error_renderer.renderer" />
<argument>%kernel.debug%</argument>
</service>

<service id="error_renderer.renderer.xml" class="Symfony\Component\ErrorRenderer\ErrorRenderer\XmlErrorRenderer">
<tag name="error_renderer.renderer" format="atom" />
<tag name="error_renderer.renderer" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
</service>

<service id="error_renderer.renderer.txt" class="Symfony\Component\ErrorRenderer\ErrorRenderer\TxtErrorRenderer">
<tag name="error_renderer.renderer" />
<argument>%kernel.debug%</argument>
<argument>%kernel.charset%</argument>
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/composer.json
Expand Up @@ -21,7 +21,7 @@
"symfony/cache": "^4.4|^5.0",
"symfony/config": "^4.2|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/error-catcher": "^4.4|^5.0",
"symfony/error-renderer": "^4.4|^5.0",
"symfony/http-foundation": "^4.3|^5.0",
"symfony/http-kernel": "^4.4|^5.0",
"symfony/polyfill-mbstring": "~1.0",
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\TwigBundle\Controller;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\TwigBundle\Controller;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;

Expand Down
Expand Up @@ -28,7 +28,7 @@ public function process(ContainerBuilder $container)
}

// register the exception controller only if Twig is enabled and required dependencies do exist
if (!class_exists('Symfony\Component\ErrorCatcher\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
if (!class_exists('Symfony\Component\ErrorRenderer\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
$container->removeDefinition('twig.exception_listener');
} elseif ($container->hasParameter('templating.engines')) {
$engines = $container->getParameter('templating.engines');
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Bundle\TwigBundle\Controller\ExceptionController;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Twig\Environment;
use Twig\Loader\ArrayLoader;
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Bundle\TwigBundle\Controller\PreviewErrorController;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/TwigBundle/composer.json
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": "^7.1.3",
"symfony/error-catcher": "^4.4|^5.0",
"symfony/error-renderer": "^4.4|^5.0",
"symfony/twig-bridge": "^4.4|^5.0",
"symfony/http-foundation": "^4.3|^5.0",
"symfony/http-kernel": "^4.4|^5.0",
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\WebProfilerBundle\Controller;

use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
Expand Down
Expand Up @@ -27,7 +27,7 @@
<argument type="service" id="twig" />
<argument>%kernel.debug%</argument>
<argument type="service" id="debug.file_link_formatter" />
<argument type="service" id="error_catcher.renderer.html" on-invalid="null" />
<argument type="service" id="error_renderer.renderer.html" on-invalid="null" />
</service>

<service id="web_profiler.csp.handler" class="Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler">
Expand Down
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
use Symfony\Component\EventDispatcher\EventDispatcher;

Expand Down Expand Up @@ -54,7 +54,7 @@ protected function setUp()
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();

$this->container = new ContainerBuilder();
$this->container->register('error_catcher.renderer.html', HtmlErrorRenderer::class);
$this->container->register('error_renderer.renderer.html', HtmlErrorRenderer::class);
$this->container->register('event_dispatcher', EventDispatcher::class)->setPublic(true);
$this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'))->setPublic(true);
$this->container->register('twig', 'Twig\Environment')->setPublic(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/CHANGELOG.md
Expand Up @@ -4,7 +4,7 @@ CHANGELOG
4.4.0
-----

* deprecated `FlattenException`, use the `FlattenException` of the `ErrorCatcher` component
* deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component

4.3.0
-----
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Debug/Exception/FlattenException.php
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorCatcher\Exception\FlattenException" instead.', FlattenException::class), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorRenderer\Exception\FlattenException" instead.', FlattenException::class), E_USER_DEPRECATED);

/**
* FlattenException wraps a PHP Error or Exception to be able to serialize it.
Expand All @@ -23,7 +23,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception\FlattenException instead.
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception\FlattenException instead.
*/
class FlattenException
{
Expand All @@ -39,11 +39,11 @@ class FlattenException
private $line;

/**
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception::createFromThrowable() instead.
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception::createFromThrowable() instead.
*/
public static function create(\Exception $exception, $statusCode = null, array $headers = [])
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception::createFromThrowable() instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception::createFromThrowable() instead.', __METHOD__), E_USER_DEPRECATED);

return static::createFromThrowable($exception, $statusCode, $headers);
}
Expand Down
Expand Up @@ -9,23 +9,23 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\DependencyInjection;
namespace Symfony\Component\ErrorRenderer\DependencyInjection;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorRendererInterface;
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;

/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class ErrorCatcherPass implements CompilerPassInterface
class ErrorRendererPass implements CompilerPassInterface
{
private $rendererService;
private $rendererTag;

public function __construct(string $rendererService = 'error_catcher.error_formatter', string $rendererTag = 'error_catcher.renderer')
public function __construct(string $rendererService = 'error_renderer', string $rendererTag = 'error_renderer.renderer')
{
$this->rendererService = $rendererService;
$this->rendererTag = $rendererTag;
Expand Down
Expand Up @@ -9,17 +9,17 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\DependencyInjection;
namespace Symfony\Component\ErrorRenderer\DependencyInjection;

use Psr\Container\ContainerInterface;
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorFormatter;
use Symfony\Component\ErrorRenderer\ErrorRenderer;

/**
* Lazily loads error renderers from the dependency injection container.
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class LazyLoadingErrorFormatter extends ErrorFormatter
class LazyLoadingErrorRenderer extends ErrorRenderer
{
private $container;
private $initialized = [];
Expand Down
Expand Up @@ -9,10 +9,11 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException;
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;
use Symfony\Component\ErrorRenderer\Exception\ErrorRendererNotFoundException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;

/**
* Formats an exception to be used as response content.
Expand All @@ -23,7 +24,7 @@
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class ErrorFormatter
class ErrorRenderer
{
private $renderers = [];

Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;

/**
* Interface for classes that can render errors in a specific format.
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;

/**
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;

/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;

/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
Expand Down
Expand Up @@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;

use Symfony\Component\ErrorCatcher\Exception\FlattenException;
use Symfony\Component\ErrorRenderer\Exception\FlattenException;

/**
* @author Yonel Ceruto <yonelceruto@gmail.com>
Expand Down
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\ErrorCatcher\Exception;
namespace Symfony\Component\ErrorRenderer\Exception;

class ErrorRendererNotFoundException extends \RuntimeException
{
Expand Down

0 comments on commit 4499e2a

Please sign in to comment.