@@ -193,17 +193,19 @@ To override non-HTML error output, the Serializer component needs to be installe
193
193
$ composer require serializer
194
194
195
195
The Serializer component has a built-in ``FlattenException `` normalizer
196
- (`` ProblemNormalizer ` `) and JSON/XML/CSV/YAML encoders. When your application
196
+ (:class: ` Symfony \\ Component \\ Serializer \\ Normalizer \\ ProblemNormalizer `) and JSON/XML/CSV/YAML encoders. When your application
197
197
throws an exception, Symfony can output it in one of those formats. If you want
198
198
to change the output contents, create a new Normalizer that supports the
199
199
``FlattenException `` input::
200
200
201
201
# src/App/Serializer/MyCustomProblemNormalizer.php
202
202
namespace App\Serializer;
203
203
204
+ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
205
+
204
206
class MyCustomProblemNormalizer implements NormalizerInterface
205
207
{
206
- public function normalize($exception, $format = null, array $context = [])
208
+ public function normalize($exception, string $format = null, array $context = [])
207
209
{
208
210
return [
209
211
'content' => 'This is my custom problem normalizer.',
@@ -214,7 +216,7 @@ to change the output contents, create a new Normalizer that supports the
214
216
];
215
217
}
216
218
217
- public function supportsNormalization($data, $format = null)
219
+ public function supportsNormalization($data, string $format = null)
218
220
{
219
221
return $data instanceof FlattenException;
220
222
}
@@ -252,14 +254,14 @@ configuration option to point to it:
252
254
https://symfony.com/schema/dic/services/services-1.0.xsd" >
253
255
254
256
<framework : config >
255
- <framework : error_controller >App\Controller\ErrorController::showAction</framework : error_controller >
257
+ <framework : error-controller >App\Controller\ErrorController::showAction</framework : error-controller >
256
258
</framework : config >
257
259
258
260
</container >
259
261
260
262
.. code-block :: php
261
263
262
- // config/packages/twig .php
264
+ // config/packages/framework .php
263
265
$container->loadFromExtension('framework', [
264
266
'error_controller' => 'App\Controller\ErrorController::showAction',
265
267
// ...
0 commit comments