From e838f8416b9fd3c6c0ec218dbb4b7fb027b0a8f6 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 26 Jun 2023 15:42:49 +0200 Subject: [PATCH] Deprecate setStatus method for Responses with a fixed status code Signed-off-by: jld3103 --- lib/public/AppFramework/Http/NotFoundResponse.php | 10 ++++++++++ lib/public/AppFramework/Http/RedirectResponse.php | 10 ++++++++++ .../AppFramework/Http/TooManyRequestsResponse.php | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/lib/public/AppFramework/Http/NotFoundResponse.php b/lib/public/AppFramework/Http/NotFoundResponse.php index 6a391c35dbb87..0c7944fcb3cc0 100644 --- a/lib/public/AppFramework/Http/NotFoundResponse.php +++ b/lib/public/AppFramework/Http/NotFoundResponse.php @@ -43,4 +43,14 @@ public function __construct() { $this->setContentSecurityPolicy(new ContentSecurityPolicy()); $this->setStatus(Http::STATUS_NOT_FOUND); } + + /** + * @inheritDoc + * @deprecated Do not use this method. It modifies the status code which you are not supposed to do on a NotFoundResponse + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status): static { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/RedirectResponse.php b/lib/public/AppFramework/Http/RedirectResponse.php index 58da1b85d5900..05f029b433530 100644 --- a/lib/public/AppFramework/Http/RedirectResponse.php +++ b/lib/public/AppFramework/Http/RedirectResponse.php @@ -58,4 +58,14 @@ public function __construct($redirectURL) { public function getRedirectURL() { return $this->redirectURL; } + + /** + * @inheritDoc + * @deprecated Do not use this method. It modifies the status code which you are not supposed to do on a RedirectResponse + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status): static { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/TooManyRequestsResponse.php b/lib/public/AppFramework/Http/TooManyRequestsResponse.php index 7f0b907034d38..bd023a5b1b4ec 100644 --- a/lib/public/AppFramework/Http/TooManyRequestsResponse.php +++ b/lib/public/AppFramework/Http/TooManyRequestsResponse.php @@ -54,4 +54,14 @@ public function render() { $template = new Template('core', '429', 'blank'); return $template->fetchPage(); } + + /** + * @inheritDoc + * @deprecated Do not use this method. It modifies the status code which you are not supposed to do on a TooManyRequestsResponse + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status): static { + parent::setStatus($status); + return $this; + } }