Skip to content

Commit 9a07631

Browse files
provokateurinbackportbot[bot]
authored andcommitted
fix(psalm): Enable psalm level 3
Signed-off-by: provokateurin <[email protected]> [skip ci]
1 parent 005ed01 commit 9a07631

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

β€Žlib/ACL/ACLManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OCP\Files\IRootFolder;
1616
use OCP\IUser;
1717
use Psr\Log\LoggerInterface;
18+
use RuntimeException;
1819

1920
class ACLManager {
2021
private CappedMemoryCache $ruleCache;
@@ -97,6 +98,9 @@ private function getRelevantPaths(string $path): array {
9798
$groupFolderId = (int)$groupFolderId;
9899
/* Remove the date part */
99100
$separatorPos = strrpos($rootTrashedItemName, '.d');
101+
if ($separatorPos === false) {
102+
throw new RuntimeException('Invalid trash item name ' . $rootTrashedItemName);
103+
}
100104
$rootTrashedItemDate = (int)substr($rootTrashedItemName, $separatorPos + 2);
101105
$rootTrashedItemName = substr($rootTrashedItemName, 0, $separatorPos);
102106
}
@@ -105,6 +109,7 @@ private function getRelevantPaths(string $path): array {
105109
$path = dirname($path);
106110
if ($fromTrashbin && ($path === '__groupfolders/trash')) {
107111
/* We are in trash and hit the root folder, continue looking for ACLs on parent folders in original location */
112+
/** @psalm-suppress PossiblyUndefinedVariable Variables are defined above */
108113
$trashItemRow = $this->trashManager->getTrashItemByFileName($groupFolderId, $rootTrashedItemName, $rootTrashedItemDate);
109114
$fromTrashbin = false;
110115
if ($trashItemRow) {

β€Žlib/ACL/ACLStorageWrapper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public function opendir($path) {
9696
}
9797

9898
$handle = parent::opendir($path);
99+
if ($handle === false) {
100+
return false;
101+
}
102+
99103
$items = [];
100104
while (($file = readdir($handle)) !== false) {
101105
if ($file !== '.' && $file !== '..') {

β€Žlib/Mount/GroupMountPoint.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace OCA\GroupFolders\Mount;
88

99
use OC\Files\Mount\MountPoint;
10+
use OC\Files\Storage\Storage;
1011
use OCP\Files\Mount\ISystemMountPoint;
1112

1213
class GroupMountPoint extends MountPoint implements ISystemMountPoint {

β€Žlib/Mount/MountProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ public function getMount(
215215
return null;
216216
}
217217
$cacheEntry = $this->getRootFolder()->getStorage()->getCache()->get($folder->getId());
218+
if ($cacheEntry === false) {
219+
return null;
220+
}
218221
}
219222

220223
$storage = $this->getRootFolder()->getStorage();

β€Žpsalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- SPDX-License-Identifier: AGPL-3.0-or-later
55
-->
66
<psalm
7-
errorLevel="4"
7+
errorLevel="3"
88
resolveFromConfigFile="true"
99
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xmlns="https://getpsalm.org/schema/config"

0 commit comments

Comments
Β (0)