add missing type hints

Signed-off-by: Paul Tirk <paultirk@paultirk.com>
This commit is contained in:
Paul Tirk 2021-03-28 21:46:07 +02:00 committed by Sean Molenaar
parent 1208dc8d71
commit f358c8213b
3 changed files with 13 additions and 6 deletions

View File

@ -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(

View File

@ -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' => [

View File

@ -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;
}