mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-05-14 04:34:05 +02:00
add missing type hints
Signed-off-by: Paul Tirk <paultirk@paultirk.com>
This commit is contained in:
parent
1208dc8d71
commit
f358c8213b
lib
@ -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(
|
||||
|
@ -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' => [
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user