Skip to content

Commit b181338

Browse files
committed
minor #12849 Update error_pages.rst (atailouloute)
This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead (closes #12849). Discussion ---------- Update error_pages.rst Small fixes, improvements Commits ------- fb3d7c1 Update error_pages.rst
2 parents 8d75116 + fb3d7c1 commit b181338

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

controller/error_pages.rst

+7-5
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,19 @@ To override non-HTML error output, the Serializer component needs to be installe
193193
$ composer require serializer
194194
195195
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
197197
throws an exception, Symfony can output it in one of those formats. If you want
198198
to change the output contents, create a new Normalizer that supports the
199199
``FlattenException`` input::
200200

201201
# src/App/Serializer/MyCustomProblemNormalizer.php
202202
namespace App\Serializer;
203203

204+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
205+
204206
class MyCustomProblemNormalizer implements NormalizerInterface
205207
{
206-
public function normalize($exception, $format = null, array $context = [])
208+
public function normalize($exception, string $format = null, array $context = [])
207209
{
208210
return [
209211
'content' => 'This is my custom problem normalizer.',
@@ -214,7 +216,7 @@ to change the output contents, create a new Normalizer that supports the
214216
];
215217
}
216218

217-
public function supportsNormalization($data, $format = null)
219+
public function supportsNormalization($data, string $format = null)
218220
{
219221
return $data instanceof FlattenException;
220222
}
@@ -252,14 +254,14 @@ configuration option to point to it:
252254
https://symfony.com/schema/dic/services/services-1.0.xsd">
253255
254256
<framework:config>
255-
<framework:error_controller>App\Controller\ErrorController::showAction</framework:error_controller>
257+
<framework:error-controller>App\Controller\ErrorController::showAction</framework:error-controller>
256258
</framework:config>
257259
258260
</container>
259261
260262
.. code-block:: php
261263
262-
// config/packages/twig.php
264+
// config/packages/framework.php
263265
$container->loadFromExtension('framework', [
264266
'error_controller' => 'App\Controller\ErrorController::showAction',
265267
// ...

0 commit comments

Comments
 (0)