File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -3806,10 +3806,25 @@ the ``#[WithLogLevel]`` attribute::
3806
3806
{
3807
3807
}
3808
3808
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.
3813
3828
3814
3829
.. _`HTTP Host header attacks` : https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
3815
3830
.. _`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
You can’t perform that action at this time.
0 commit comments