Skip to content

Commit b9112bb

Browse files
committed
-
1 parent 0572d4b commit b9112bb

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

reference/configuration/framework.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,10 +3806,25 @@ the ``#[WithLogLevel]`` attribute::
38063806
{
38073807
}
38083808

3809-
``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes also work with parent
3810-
classes and (since 7.1) interfaces. To find the effective HTTP status and log
3811-
level, the framework will look on the parent hierarchy first, starting on the
3812-
immediate parent, then it will look on the interfaces.
3809+
Both attributes can also be added to interfaces implemented by exceptions::
3810+
3811+
namespace App\Exception;
3812+
3813+
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
3814+
3815+
#[WithHttpStatus(422)]
3816+
interface CustomExceptionInterface
3817+
{
3818+
}
3819+
3820+
class CustomException extends \Exception implements CustomExceptionInterface
3821+
{
3822+
}
3823+
3824+
.. versionadded:: 7.1
3825+
3826+
Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes
3827+
on interfaces, was introduced in Symfony 7.1.
38133828

38143829
.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
38153830
.. _`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

0 commit comments

Comments
 (0)