Skip to content

Update framework.exceptions XML and PHP configuration examples #17455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3579,12 +3579,11 @@ exceptions that match the given exception class:
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:exceptions>
<exception id="Symfony\Component\HttpKernel\Exception\BadRequestHttpException">
<framework:log_level>debug</framework:log_level>
<framework:status_code>422</framework:status_code>
</exception>
</framework:exceptions>
<framework:exception
class="Symfony\Component\HttpKernel\Exception\BadRequestHttpException"
log-level="debug"
status-code="422"
/>
<!-- ... -->
</framework:config>
</container>
Expand All @@ -3596,13 +3595,9 @@ exceptions that match the given exception class:
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework
->exceptions(BadRequestHttpException::class)
->log_level('debug');

$framework
->exceptions(BadRequestHttpException::class)
->status_code(422);
$framework->exception(BadRequestHttpException::class)
->logLevel('debug')
->statusCode(422)
;
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated directive for version 6.3 is missing. Can you add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really necessary since the deprecated format was never documented?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it is not necessary

Expand Down