WithHttpStatus.php 790 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Attribute;
  11. /**
  12. * Defines the HTTP status code applied to an exception.
  13. *
  14. * @author Dejan Angelov <angelovdejan@protonmail.com>
  15. */
  16. #[\Attribute(\Attribute::TARGET_CLASS)]
  17. class WithHttpStatus
  18. {
  19. /**
  20. * @param int $statusCode The HTTP status code to use
  21. * @param array<string, string> $headers The HTTP headers to add to the response
  22. */
  23. public function __construct(
  24. public readonly int $statusCode,
  25. public readonly array $headers = [],
  26. ) {
  27. }
  28. }