From 420bf581e50dd273feebaf2fdbed523e744f387f Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 27 Dec 2023 20:21:30 +0700 Subject: [PATCH] Document `#[WithHttpStatus]` and `#[WithLogLevel]` on interfaces. --- reference/configuration/framework.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 894cf7a82c5..2e82f352af0 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -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