diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index c4b781e53578f..7284dc443dfb9 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -90,4 +90,30 @@ public function setData($data) { public function getData() { return $this->data; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/DataDownloadResponse.php b/lib/public/AppFramework/Http/DataDownloadResponse.php index d578985bf6b59..6fd96210601ef 100644 --- a/lib/public/AppFramework/Http/DataDownloadResponse.php +++ b/lib/public/AppFramework/Http/DataDownloadResponse.php @@ -66,4 +66,30 @@ public function setData($data) { public function render() { return $this->data; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/DataResponse.php b/lib/public/AppFramework/Http/DataResponse.php index c8d78255b0110..4f7c24333d135 100644 --- a/lib/public/AppFramework/Http/DataResponse.php +++ b/lib/public/AppFramework/Http/DataResponse.php @@ -83,4 +83,30 @@ public function setData($data) { public function getData() { return $this->data; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/DownloadResponse.php b/lib/public/AppFramework/Http/DownloadResponse.php index 2e54539412cc7..8b9900039f5cb 100644 --- a/lib/public/AppFramework/Http/DownloadResponse.php +++ b/lib/public/AppFramework/Http/DownloadResponse.php @@ -49,4 +49,30 @@ public function __construct(string $filename, string $contentType) { $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"'); $this->addHeader('Content-Type', $contentType); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/FileDisplayResponse.php b/lib/public/AppFramework/Http/FileDisplayResponse.php index 141376733b5c1..a59009a6b4888 100644 --- a/lib/public/AppFramework/Http/FileDisplayResponse.php +++ b/lib/public/AppFramework/Http/FileDisplayResponse.php @@ -71,4 +71,30 @@ public function callback(IOutput $output) { $output->setOutput($this->file->getContent()); } } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/JSONResponse.php b/lib/public/AppFramework/Http/JSONResponse.php index 19389f97d3b51..4ca7dcf3a0e93 100644 --- a/lib/public/AppFramework/Http/JSONResponse.php +++ b/lib/public/AppFramework/Http/JSONResponse.php @@ -93,4 +93,30 @@ public function setData($data) { public function getData() { return $this->data; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/NotFoundResponse.php b/lib/public/AppFramework/Http/NotFoundResponse.php index 6a391c35dbb87..333a924ea9f50 100644 --- a/lib/public/AppFramework/Http/NotFoundResponse.php +++ b/lib/public/AppFramework/Http/NotFoundResponse.php @@ -43,4 +43,26 @@ public function __construct() { $this->setContentSecurityPolicy(new ContentSecurityPolicy()); $this->setStatus(Http::STATUS_NOT_FOUND); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @depreacted 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) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/RedirectResponse.php b/lib/public/AppFramework/Http/RedirectResponse.php index 58da1b85d5900..c9cb41299f8f0 100644 --- a/lib/public/AppFramework/Http/RedirectResponse.php +++ b/lib/public/AppFramework/Http/RedirectResponse.php @@ -58,4 +58,26 @@ public function __construct($redirectURL) { public function getRedirectURL() { return $this->redirectURL; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @depreacted 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) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php index 9b81ffa6a4fca..76105e9c3915c 100644 --- a/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php +++ b/lib/public/AppFramework/Http/RedirectToDefaultAppResponse.php @@ -49,4 +49,26 @@ public function __construct() { $urlGenerator = \OC::$server->get(IURLGenerator::class); parent::__construct($urlGenerator->linkToDefaultPageUrl()); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @depreacted Do not use this method. It modifies the status code which you are not supposed to do on a RedirectToDefaultAppResponse + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/StandaloneTemplateResponse.php b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php index 8a39dca71e3f0..def1efbe3e7b4 100644 --- a/lib/public/AppFramework/Http/StandaloneTemplateResponse.php +++ b/lib/public/AppFramework/Http/StandaloneTemplateResponse.php @@ -38,4 +38,29 @@ * @template-extends TemplateResponse> */ class StandaloneTemplateResponse extends TemplateResponse { + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/StreamResponse.php b/lib/public/AppFramework/Http/StreamResponse.php index 3aa60a4157e1f..ed3c2a6e08ec4 100644 --- a/lib/public/AppFramework/Http/StreamResponse.php +++ b/lib/public/AppFramework/Http/StreamResponse.php @@ -68,4 +68,30 @@ public function callback(IOutput $output) { } } } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 34940cc7f7445..a49830aecc2d4 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -157,4 +157,30 @@ public function render(): string { $this->setParams($params); return parent::render(); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php index b1db08b140c5e..80260933d036b 100644 --- a/lib/public/AppFramework/Http/TemplateResponse.php +++ b/lib/public/AppFramework/Http/TemplateResponse.php @@ -216,4 +216,30 @@ public function render() { return $template->fetchPage($this->params); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/TextPlainResponse.php b/lib/public/AppFramework/Http/TextPlainResponse.php index 81975a60b3d69..610785b810de0 100644 --- a/lib/public/AppFramework/Http/TextPlainResponse.php +++ b/lib/public/AppFramework/Http/TextPlainResponse.php @@ -63,4 +63,30 @@ public function __construct(string $text = '', int $statusCode = Http::STATUS_OK public function render() : string { return $this->text; } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/TooManyRequestsResponse.php b/lib/public/AppFramework/Http/TooManyRequestsResponse.php index 7f0b907034d38..ffc1e006ce1f4 100644 --- a/lib/public/AppFramework/Http/TooManyRequestsResponse.php +++ b/lib/public/AppFramework/Http/TooManyRequestsResponse.php @@ -54,4 +54,26 @@ public function render() { $template = new Template('core', '429', 'blank'); return $template->fetchPage(); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @depreacted 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) { + parent::setStatus($status); + return $this; + } } diff --git a/lib/public/AppFramework/Http/ZipResponse.php b/lib/public/AppFramework/Http/ZipResponse.php index daf414df71b5d..c97b1a824f479 100644 --- a/lib/public/AppFramework/Http/ZipResponse.php +++ b/lib/public/AppFramework/Http/ZipResponse.php @@ -93,4 +93,30 @@ public function callback(IOutput $output) { $zip->finalize(); } + + /** + * @inheritDoc + * @template NewH as array + * @param NewH $headers value header pairs + * @psalm-this-out self + * @return $this + * @since 8.0.0 + */ + public function setHeaders(array $headers) { + parent::setHeaders($headers); + return $this; + } + + /** + * @inheritDoc + * @template NewS as int + * @param NewS $status + * @psalm-this-out self + * @return $this + * @since 6.0.0 - return value was added in 7.0.0 + */ + public function setStatus($status) { + parent::setStatus($status); + return $this; + } }