From 71a17dcc6933cac48172b36e65d3db5a157bc7ea Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 9 Sep 2024 15:15:18 +0200 Subject: [PATCH] feat(psalm): Enable more/less specific issue handlers Signed-off-by: provokateurin --- lib/Folder/FolderManager.php | 6 +++--- lib/Trash/TrashBackend.php | 9 ++++++--- lib/Versions/VersionsBackend.php | 4 +++- psalm.xml | 4 ++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/Folder/FolderManager.php b/lib/Folder/FolderManager.php index 396f0e8dc..068a27e28 100644 --- a/lib/Folder/FolderManager.php +++ b/lib/Folder/FolderManager.php @@ -519,7 +519,7 @@ public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): arr $this->joinQueryWithFileCache($query, $rootStorageId); $result = $query->executeQuery()->fetchAll(); - return array_map(function ($folder): array { + return array_values(array_map(function ($folder): array { return [ 'folder_id' => (int)$folder['folder_id'], 'mount_point' => (string)$folder['mount_point'], @@ -528,7 +528,7 @@ public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): arr 'acl' => (bool)$folder['acl'], 'rootCacheEntry' => (isset($folder['fileid'])) ? Cache::cacheEntryFromData($folder, $this->mimeTypeLoader) : null ]; - }, $result); + }, $result)); } /** @@ -877,7 +877,7 @@ public function setFolderACL(int $folderId, bool $acl): void { /** * @param IUser $user * @param int $rootStorageId - * @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}[] + * @return list * @throws Exception */ public function getFoldersForUser(IUser $user, int $rootStorageId = 0): array { diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php index 69548ac41..b0b7d17b3 100644 --- a/lib/Trash/TrashBackend.php +++ b/lib/Trash/TrashBackend.php @@ -277,16 +277,19 @@ private function getNodeForTrashItem(IUser $user, ITrashItem $trashItem): ?Node private function getTrashRoot(): Folder { try { - return $this->appFolder->get('trash'); + /** @var Folder $folder */ + $folder = $this->appFolder->get('trash'); + return $folder; } catch (NotFoundException $e) { return $this->appFolder->newFolder('trash'); - ; } } private function getTrashFolder(int $folderId): Folder { try { - return $this->appFolder->get('trash/' . $folderId); + /** @var Folder $folder */ + $folder = $this->appFolder->get('trash/' . $folderId); + return $folder; } catch (NotFoundException $e) { /** @var Folder $trashRoot */ $trashRoot = $this->appFolder->nodeExists('trash') ? $this->appFolder->get('trash') : $this->appFolder->newFolder('trash'); diff --git a/lib/Versions/VersionsBackend.php b/lib/Versions/VersionsBackend.php index a8004ea66..b8e99f988 100644 --- a/lib/Versions/VersionsBackend.php +++ b/lib/Versions/VersionsBackend.php @@ -283,7 +283,9 @@ public function deleteAllVersionsForFile(int $folderId, int $fileId): void { private function getVersionsFolder(int $folderId): Folder { try { - return $this->appFolder->get('versions/' . $folderId); + /** @var Folder $folder */ + $folder = $this->appFolder->get('versions/' . $folderId); + return $folder; } catch (NotFoundException $e) { /** @var Folder $trashRoot */ $trashRoot = $this->appFolder->nodeExists('versions') ? $this->appFolder->get('versions') : $this->appFolder->newFolder('versions'); diff --git a/psalm.xml b/psalm.xml index 7d4074c62..dd2db04f9 100644 --- a/psalm.xml +++ b/psalm.xml @@ -63,5 +63,9 @@ + + + +