diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-19 14:53:54 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-01-20 11:22:09 +0100 |
commit | 2a5e18b67af256ec545ceece8ac49ca2133e764f (patch) | |
tree | 7c1772c97ef48a42900496de13abb4da41c7fc00 /lib/private/AppFramework | |
parent | f2cdc4f47d9136b54159557136dad892dcd31ec2 (diff) | |
download | nextcloud-server-2a5e18b67af256ec545ceece8ac49ca2133e764f.tar.gz nextcloud-server-2a5e18b67af256ec545ceece8ac49ca2133e764f.zip |
Fix types in OCS json answer (status code is an int)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r-- | lib/private/AppFramework/OCS/BaseResponse.php | 2 | ||||
-rw-r--r-- | lib/private/AppFramework/OCS/V1Response.php | 3 | ||||
-rw-r--r-- | lib/private/AppFramework/OCS/V2Response.php | 3 |
3 files changed, 3 insertions, 5 deletions
diff --git a/lib/private/AppFramework/OCS/BaseResponse.php b/lib/private/AppFramework/OCS/BaseResponse.php index f9577a7a5f2..d3904065102 100644 --- a/lib/private/AppFramework/OCS/BaseResponse.php +++ b/lib/private/AppFramework/OCS/BaseResponse.php @@ -92,7 +92,7 @@ abstract class BaseResponse extends Response { } /** - * @param string[] $meta + * @param array<string,string|int> $meta * @return string */ protected function renderResult(array $meta): string { diff --git a/lib/private/AppFramework/OCS/V1Response.php b/lib/private/AppFramework/OCS/V1Response.php index 8c402809cc4..cca3c267ec4 100644 --- a/lib/private/AppFramework/OCS/V1Response.php +++ b/lib/private/AppFramework/OCS/V1Response.php @@ -28,7 +28,6 @@ use OCP\AppFramework\Http; use OCP\AppFramework\OCSController; class V1Response extends BaseResponse { - /** * The V1 endpoint has very limited http status codes basically everything * is status 200 except 401 @@ -68,7 +67,7 @@ class V1Response extends BaseResponse { public function render() { $meta = [ 'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure', - 'statuscode' => (string)$this->getOCSStatus(), + 'statuscode' => $this->getOCSStatus(), 'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage ?? '', 'totalitems' => (string)($this->itemsCount ?? ''), 'itemsperpage' => (string)($this->itemsPerPage ?? ''), diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index 6c302698bc9..8bf4c37a578 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -27,7 +27,6 @@ use OCP\AppFramework\Http; use OCP\AppFramework\OCSController; class V2Response extends BaseResponse { - /** * The V2 endpoint just passes on status codes. * Of course we have to map the OCS specific codes to proper HTTP status codes @@ -61,7 +60,7 @@ class V2Response extends BaseResponse { $meta = [ 'status' => $status >= 200 && $status < 300 ? 'ok' : 'failure', 'statuscode' => $this->getOCSStatus(), - 'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage, + 'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage ?? '', ]; if ($this->itemsCount !== null) { |