Update nextcloud coding standard

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2021-01-21 13:41:26 +01:00
parent 6d5e289f23
commit 9b8fd21fdf
11 changed files with 33 additions and 33 deletions

View File

@ -20,7 +20,7 @@
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"nextcloud/coding-standard": "^0.3.0",
"nextcloud/coding-standard": "^0.5.0",
"vimeo/psalm": "^4",
"christophwurst/nextcloud": "v20.0.4"
},

18
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d4a1f5f147c950df8005be9a7a88e97e",
"content-hash": "90a43b4b41f37c25c379318826e9267a",
"packages": [
{
"name": "brick/math",
@ -2976,21 +2976,21 @@
},
{
"name": "nextcloud/coding-standard",
"version": "v0.3.0",
"version": "v0.5.0",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
"reference": "4f5cd012760f8293e19e602651a0ecaa265e4db9"
"reference": "742ed895ae76c10daf95e08488cfb3f554199f40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/4f5cd012760f8293e19e602651a0ecaa265e4db9",
"reference": "4f5cd012760f8293e19e602651a0ecaa265e4db9",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/742ed895ae76c10daf95e08488cfb3f554199f40",
"reference": "742ed895ae76c10daf95e08488cfb3f554199f40",
"shasum": ""
},
"require": {
"friendsofphp/php-cs-fixer": "^2.16",
"php": "^7.2"
"friendsofphp/php-cs-fixer": "^2.17",
"php": "^7.2|^8.0"
},
"type": "library",
"autoload": {
@ -3011,9 +3011,9 @@
"description": "Nextcloud coding standards for the php cs fixer",
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v0.3.0"
"source": "https://github.com/nextcloud/coding-standard/tree/v0.5.0"
},
"time": "2020-04-10T14:57:18+00:00"
"time": "2021-01-11T14:15:58+00:00"
},
{
"name": "nikic/php-parser",

View File

@ -18,7 +18,7 @@ use OCP\IConfig;
class CrawlJob extends TimedJob {
public const BATCH_SIZE = 120; // 120 bookmarks
public const INTERVAL = 30*60; // 30 minutes
public const INTERVAL = 30 * 60; // 30 minutes
/**
* @var BookmarkMapper

View File

@ -342,7 +342,7 @@ class BookmarkController extends ApiController {
/** @var Folder $folderEntity */
$folderEntity = $this->folderMapper->find($this->toInternalFolderId($folder));
$userId = $folderEntity->getUserId();
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return new DataResponse(['status' => 'error', 'data' => 'Not found'], Http::STATUS_BAD_REQUEST);
}
$params->setFolder($this->toInternalFolderId($folder));
@ -353,7 +353,7 @@ class BookmarkController extends ApiController {
} else {
try {
$result = $this->bookmarkMapper->findAllInPublicFolder($this->authorizer->getToken(), $params);
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return new DataResponse(['status' => 'error', 'data' => 'Not found'], Http::STATUS_BAD_REQUEST);
}
}
@ -476,7 +476,7 @@ class BookmarkController extends ApiController {
public function deleteBookmark($id): JSONResponse {
try {
$this->bookmarkMapper->find($id);
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return new JSONResponse(['status' => 'success']);
}
if (!Authorizer::hasPermission(Authorizer::PERM_EDIT, $this->authorizer->getPermissionsForBookmark($id, $this->request))) {
@ -553,7 +553,7 @@ class BookmarkController extends ApiController {
return new RedirectResponse($this->url->getAbsoluteURL('/index.php/svg/core/places/link?color=666666'));
}
return $this->doImageResponse($image);
} catch (DoesNotExistException|MultipleObjectsReturnedException|Exception $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException | Exception $e) {
return new NotFoundResponse();
}
}
@ -579,7 +579,7 @@ class BookmarkController extends ApiController {
return new RedirectResponse($this->url->getAbsoluteURL('/index.php/svg/core/places/link?color=666666'));
}
return $this->doImageResponse($image);
} catch (DoesNotExistException|MultipleObjectsReturnedException|Exception $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException | Exception $e) {
return new NotFoundResponse();
}
}

View File

@ -297,7 +297,7 @@ class FoldersController extends ApiController {
if ($folderId !== -1) {
try {
$this->folders->findSharedFolderOrFolder($this->authorizer->getUserId(), $folderId);
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return new JSONResponse(['status' => 'success']);
}
}

View File

@ -134,7 +134,7 @@ class InternalBookmarkController extends ApiController {
public function deleteAllBookmarks(): DataResponse {
try {
$this->bookmarks->deleteAll($this->userId);
} catch (UnsupportedOperation|DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (UnsupportedOperation | DoesNotExistException | MultipleObjectsReturnedException $e) {
return new DataResponse(['status' => 'error', 'data' => ['Internal server error']], Http::STATUS_INTERNAL_SERVER_ERROR);
}
return new DataResponse(['status' => 'success']);

View File

@ -97,7 +97,7 @@ class WebViewController extends Controller {
* @return AugmentedTemplateResponse
*/
public function index(): AugmentedTemplateResponse {
$res = new AugmentedTemplateResponse($this->appName, 'main', ['url'=>$this->urlGenerator]);
$res = new AugmentedTemplateResponse($this->appName, 'main', ['url' => $this->urlGenerator]);
$policy = new ContentSecurityPolicy();
$policy->addAllowedWorkerSrcDomain("'self'");
@ -189,8 +189,8 @@ class WebViewController extends Controller {
[
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon',
['app' => 'bookmarks']),
'type'=> 'image/png',
'sizes'=> '512x512'
'type' => 'image/png',
'sizes' => '512x512'
],
[
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon',

View File

@ -480,7 +480,7 @@ class TreeMapper extends QBMapper {
$qb = $this->insertQuery;
$qb
->setParameters(['id'=>$itemId,
->setParameters(['id' => $itemId,
'parent_folder' => $newParentFolderId,
'type' => $type,
'index' => $index ?? $this->countChildren($newParentFolderId),
@ -531,7 +531,7 @@ class TreeMapper extends QBMapper {
* @param int|null $index
* @throws UnsupportedOperation
*/
public function addToFolders(string $type, int $itemId, array $folders, int $index=null): void {
public function addToFolders(string $type, int $itemId, array $folders, int $index = null): void {
if ($type !== self::TYPE_BOOKMARK) {
throw new UnsupportedOperation('Only bookmarks can be in multiple folders');
}

View File

@ -104,7 +104,7 @@ class Bookmark implements IEntity, IUrl {
}
try {
$this->bookmark = $this->bookmarkMapper->find($event->getId());
} catch (DoesNotExistException|MultipleObjectsReturnedException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return;
}
$ruleMatcher->setEntitySubject($this, $this->bookmark);

View File

@ -74,6 +74,6 @@ class Provider implements IProvider {
return new SearchResultEntry($favicon, $bookmark->getTitle(), $bookmark->getUrl(), $resourceUrl);
}, $bookmarks);
return SearchResult::paginated($this->getName(), $results, $params->getLimit()+$params->getOffset());
return SearchResult::paginated($this->getName(), $results, $params->getLimit() + $params->getOffset());
}
}

View File

@ -125,7 +125,7 @@ class BookmarksParser {
// set root folder
$this->currentFolder = ['bookmarks' => [], 'children' => []];
$this->folderDepth[] =& $this->currentFolder;
$this->folderDepth[] = & $this->currentFolder;
$this->traverse();
return empty($this->bookmarks) ? null : $this->bookmarks;
@ -189,9 +189,9 @@ class BookmarksParser {
if (isset($folder['personal_toolbar_folder']) && $this->ignorePersonalToolbarFolder) {
return;
}
$this->currentFolder['children'][] =& $folder;
$this->folderDepth[] =& $folder;
$this->currentFolder =& $folder;
$this->currentFolder['children'][] = & $folder;
$this->folderDepth[] = & $folder;
$this->currentFolder = & $folder;
}
/**
@ -199,7 +199,7 @@ class BookmarksParser {
*/
private function closeFolder(): void {
array_pop($this->folderDepth);
$this->currentFolder =& $this->folderDepth[count($this->folderDepth) - 1];
$this->currentFolder = & $this->folderDepth[count($this->folderDepth) - 1];
}
/**
@ -220,8 +220,8 @@ class BookmarksParser {
$bookmark['tags'] = $tags;
}
}
$this->currentFolder['bookmarks'][] =& $bookmark;
$this->bookmarks[] =& $bookmark;
$this->currentFolder['bookmarks'][] = & $bookmark;
$this->bookmarks[] = & $bookmark;
}
/**
@ -234,7 +234,7 @@ class BookmarksParser {
if ($count === 0) {
return;
}
$bookmark =& $this->bookmarks[$count - 1];
$bookmark = & $this->bookmarks[$count - 1];
$bookmark['description'] = $node->textContent;
}