Merge pull request #9284 from nextcloud/bugfix/9279/strict_sharee_api
Make ShareesAPIController strict
This commit is contained in:
commit
c907b68842
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||
*
|
||||
|
@ -90,7 +91,7 @@ class ShareesAPIController extends OCSController {
|
|||
* @param ISearch $collaboratorSearch
|
||||
*/
|
||||
public function __construct(
|
||||
$appName,
|
||||
string $appName,
|
||||
IRequest $request,
|
||||
IConfig $config,
|
||||
IURLGenerator $urlGenerator,
|
||||
|
@ -117,7 +118,7 @@ class ShareesAPIController extends OCSController {
|
|||
* @return DataResponse
|
||||
* @throws OCSBadRequestException
|
||||
*/
|
||||
public function search($search = '', $itemType = null, $page = 1, $perPage = 200, $shareType = null, $lookup = true) {
|
||||
public function search(string $search = '', string $itemType = null, int $page = 1, int $perPage = 200, $shareType = null, bool $lookup = true): DataResponse {
|
||||
|
||||
// only search for string larger than a given threshold
|
||||
$threshold = (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0);
|
||||
|
@ -205,7 +206,7 @@ class ShareesAPIController extends OCSController {
|
|||
* @param string $itemType
|
||||
* @return bool
|
||||
*/
|
||||
protected function isRemoteSharingAllowed($itemType) {
|
||||
protected function isRemoteSharingAllowed(string $itemType): bool {
|
||||
try {
|
||||
// FIXME: static foo makes unit testing unnecessarily difficult
|
||||
$backend = \OC\Share\Share::getBackend($itemType);
|
||||
|
@ -223,7 +224,7 @@ class ShareesAPIController extends OCSController {
|
|||
* @param array $params Parameters for the URL
|
||||
* @return string
|
||||
*/
|
||||
protected function getPaginationLink($page, array $params) {
|
||||
protected function getPaginationLink(int $page, array $params): string {
|
||||
if ($this->isV2()) {
|
||||
$url = $this->urlGenerator->getAbsoluteURL('/ocs/v2.php/apps/files_sharing/api/v1/sharees') . '?';
|
||||
} else {
|
||||
|
@ -236,7 +237,7 @@ class ShareesAPIController extends OCSController {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isV2() {
|
||||
protected function isV2(): bool {
|
||||
return $this->request->getScriptName() === '/ocs/v2.php';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue