summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorPaul Tirk <paultirk@paultirk.com>2021-03-28 21:46:07 +0200
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 10:23:11 +0200
commitf358c8213b5110144de207c2571a716dba3f0031 (patch)
treee9c9ce40f84b59da293633519e0c4130a93907dd /lib/Controller
parent1208dc8d7190ee3cb7b268083916538059da1c5f (diff)
add missing type hints
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/FolderApiV2Controller.php13
-rw-r--r--lib/Controller/JSONHttpErrorTrait.php4
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/Controller/FolderApiV2Controller.php b/lib/Controller/FolderApiV2Controller.php
index d8ad21fe6..3c9a12c14 100644
--- a/lib/Controller/FolderApiV2Controller.php
+++ b/lib/Controller/FolderApiV2Controller.php
@@ -24,7 +24,14 @@ class FolderApiV2Controller extends ApiController
use ApiPayloadTrait;
use JSONHttpErrorTrait;
+ /**
+ * @var FolderServiceV2
+ */
private $folderService;
+
+ /**
+ * @var ItemServiceV2
+ */
private $itemService;
public function __construct(
@@ -47,7 +54,7 @@ class FolderApiV2Controller extends ApiController
* @param string $name
* @return array|mixed|\OCP\AppFramework\Http\JSONResponse
*/
- public function create($name)
+ public function create(string $name)
{
if (empty($name)) {
return $this->errorResponseV2('folder name is empty', 1, Http::STATUS_BAD_REQUEST);
@@ -70,7 +77,7 @@ class FolderApiV2Controller extends ApiController
* @param string $name
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function update($folderId, $name)
+ public function update(int $folderId, string $name)
{
if (empty($name)) {
return $this->errorResponseV2('folder name is empty', 1, Http::STATUS_BAD_REQUEST);
@@ -97,7 +104,7 @@ class FolderApiV2Controller extends ApiController
* @param int $folderId
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function delete($folderId)
+ public function delete(int $folderId)
{
try {
$responseData = $this->serializeEntityV2(
diff --git a/lib/Controller/JSONHttpErrorTrait.php b/lib/Controller/JSONHttpErrorTrait.php
index 3defc47c1..abfef77a1 100644
--- a/lib/Controller/JSONHttpErrorTrait.php
+++ b/lib/Controller/JSONHttpErrorTrait.php
@@ -30,7 +30,7 @@ trait JSONHttpErrorTrait
* @param int $code
* @return \OCP\AppFramework\Http\JSONResponse
*/
- public function errorResponseWithExceptionV2(\Exception $exception, $code)
+ public function errorResponseWithExceptionV2(\Exception $exception, int $code): JSONResponse
{
return $this->errorResponseV2(
$exception->getMessage(),
@@ -45,7 +45,7 @@ trait JSONHttpErrorTrait
* @param int $httpStatusCode
* @return \OCP\AppFramework\Http\JSONResponse
*/
- public function errorResponseV2(string $message, int $code, int $httpStatusCode)
+ public function errorResponseV2(string $message, int $code, int $httpStatusCode): JSONResponse
{
return new JSONResponse([
'error' => [