From b56ae68854c671a45629b67c67bc197bb3eb8ac4 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 2 Mar 2021 12:27:02 +0200 Subject: [PATCH] request interface fixes --- application/Espo/Core/Api/Request.php | 2 ++ application/Espo/Core/Api/RequestNull.php | 6 ++++++ application/Espo/Core/Api/RequestWrapper.php | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/application/Espo/Core/Api/Request.php b/application/Espo/Core/Api/Request.php index bd0f3abada..e048219d39 100644 --- a/application/Espo/Core/Api/Request.php +++ b/application/Espo/Core/Api/Request.php @@ -112,6 +112,8 @@ interface Request /** * Get a server param value. + * + * @return ?mixed */ public function getServerParam(string $name); } diff --git a/application/Espo/Core/Api/RequestNull.php b/application/Espo/Core/Api/RequestNull.php index 94ed3ecb3c..39574bc853 100644 --- a/application/Espo/Core/Api/RequestNull.php +++ b/application/Espo/Core/Api/RequestNull.php @@ -47,6 +47,9 @@ class RequestNull implements ApiRequest return false; } + /** + * @return ?string|array + */ public function getQueryParam(string $name) { return null; @@ -112,6 +115,9 @@ class RequestNull implements ApiRequest return null; } + /** + * @return ?mixed + */ public function getServerParam(string $name) { return null; diff --git a/application/Espo/Core/Api/RequestWrapper.php b/application/Espo/Core/Api/RequestWrapper.php index 4ecede0d2e..7b731a4956 100644 --- a/application/Espo/Core/Api/RequestWrapper.php +++ b/application/Espo/Core/Api/RequestWrapper.php @@ -102,6 +102,9 @@ class RequestWrapper implements ApiRequest return array_key_exists($name, $this->request->getQueryParams()); } + /** + * @return ?string|array + */ public function getQueryParam(string $name) { $value = $this->request->getQueryParams()[$name] ?? null; @@ -192,7 +195,10 @@ class RequestWrapper implements ApiRequest return $params[$name] ?? null; } - public function getServerParam(string $name) : ?string + /** + * @return ?mixed + */ + public function getServerParam(string $name) { $params = $this->request->getServerParams();