diff options
author | Paul Tirk <paultirk@paultirk.com> | 2021-03-28 21:46:07 +0200 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 10:23:11 +0200 |
commit | f358c8213b5110144de207c2571a716dba3f0031 (patch) | |
tree | e9c9ce40f84b59da293633519e0c4130a93907dd /lib | |
parent | 1208dc8d7190ee3cb7b268083916538059da1c5f (diff) |
add missing type hints
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/FolderApiV2Controller.php | 13 | ||||
-rw-r--r-- | lib/Controller/JSONHttpErrorTrait.php | 4 | ||||
-rw-r--r-- | lib/Db/IAPI.php | 2 |
3 files changed, 13 insertions, 6 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' => [ diff --git a/lib/Db/IAPI.php b/lib/Db/IAPI.php index 3184d7a79..0c863ea66 100644 --- a/lib/Db/IAPI.php +++ b/lib/Db/IAPI.php @@ -18,5 +18,5 @@ namespace OCA\News\Db; interface IAPI { public function toAPI(); - public function toAPI2(bool $reduced = false); + public function toAPI2(bool $reduced = false): array; } |