From fb3d7c1ef4042071cdb6df8b27fd7342388e0d7a Mon Sep 17 00:00:00 2001 From: Ahmed TAILOULOUTE Date: Wed, 25 Dec 2019 17:09:14 +0100 Subject: [PATCH] Update error_pages.rst --- controller/error_pages.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/controller/error_pages.rst b/controller/error_pages.rst index 2e3743eab14..951b7c6cb02 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -193,7 +193,7 @@ To override non-HTML error output, the Serializer component needs to be installe $ composer require serializer The Serializer component has a built-in ``FlattenException`` normalizer -(``ProblemNormalizer``) and JSON/XML/CSV/YAML encoders. When your application +(:class:`Symfony\\Component\\Serializer\\Normalizer\\ProblemNormalizer`) and JSON/XML/CSV/YAML encoders. When your application throws an exception, Symfony can output it in one of those formats. If you want to change the output contents, create a new Normalizer that supports the ``FlattenException`` input:: @@ -201,9 +201,11 @@ to change the output contents, create a new Normalizer that supports the # src/App/Serializer/MyCustomProblemNormalizer.php namespace App\Serializer; + use Symfony\Component\Serializer\Normalizer\NormalizerInterface; + class MyCustomProblemNormalizer implements NormalizerInterface { - public function normalize($exception, $format = null, array $context = []) + public function normalize($exception, string $format = null, array $context = []) { return [ 'content' => 'This is my custom problem normalizer.', @@ -214,7 +216,7 @@ to change the output contents, create a new Normalizer that supports the ]; } - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, string $format = null) { return $data instanceof FlattenException; } @@ -252,14 +254,14 @@ configuration option to point to it: https://symfony.com/schema/dic/services/services-1.0.xsd"> - App\Controller\ErrorController::showAction + App\Controller\ErrorController::showAction .. code-block:: php - // config/packages/twig.php + // config/packages/framework.php $container->loadFromExtension('framework', [ 'error_controller' => 'App\Controller\ErrorController::showAction', // ...