Skip to content

Document #[WithHttpStatus] and #[WithLogLevel] on interfaces. #19344

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
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
20 changes: 20 additions & 0 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3806,6 +3806,26 @@ the ``#[WithLogLevel]`` attribute::
{
}

The attributes can also be added to interfaces directly::

namespace App\Exception;

use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;

#[WithHttpStatus(422)]
interface CustomExceptionInterface
{
}

class CustomException extends \Exception implements CustomExceptionInterface
{
}

.. versionadded:: 7.1

Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes
on interfaces, was introduced in Symfony 7.1.

.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
.. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
.. _`phpstorm-url-handler`: https://github.com/sanduhrs/phpstorm-url-handler
Expand Down