Skip to content

Commit

Permalink
fix(psalm): Enable psalm level 3
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>

[skip ci]
  • Loading branch information
provokateurin authored and backportbot[bot] committed Mar 11, 2025
1 parent 005ed01 commit 9a07631
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/ACL/ACLManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\Files\IRootFolder;
use OCP\IUser;
use Psr\Log\LoggerInterface;
use RuntimeException;

class ACLManager {
private CappedMemoryCache $ruleCache;
Expand Down Expand Up @@ -97,6 +98,9 @@ private function getRelevantPaths(string $path): array {
$groupFolderId = (int)$groupFolderId;
/* Remove the date part */
$separatorPos = strrpos($rootTrashedItemName, '.d');
if ($separatorPos === false) {
throw new RuntimeException('Invalid trash item name ' . $rootTrashedItemName);
}
$rootTrashedItemDate = (int)substr($rootTrashedItemName, $separatorPos + 2);
$rootTrashedItemName = substr($rootTrashedItemName, 0, $separatorPos);
}
Expand All @@ -105,6 +109,7 @@ private function getRelevantPaths(string $path): array {
$path = dirname($path);
if ($fromTrashbin && ($path === '__groupfolders/trash')) {
/* We are in trash and hit the root folder, continue looking for ACLs on parent folders in original location */
/** @psalm-suppress PossiblyUndefinedVariable Variables are defined above */
$trashItemRow = $this->trashManager->getTrashItemByFileName($groupFolderId, $rootTrashedItemName, $rootTrashedItemDate);
$fromTrashbin = false;
if ($trashItemRow) {
Expand Down
4 changes: 4 additions & 0 deletions lib/ACL/ACLStorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public function opendir($path) {
}

$handle = parent::opendir($path);
if ($handle === false) {
return false;
}

$items = [];
while (($file = readdir($handle)) !== false) {
if ($file !== '.' && $file !== '..') {
Expand Down
1 change: 1 addition & 0 deletions lib/Mount/GroupMountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace OCA\GroupFolders\Mount;

use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Storage;
use OCP\Files\Mount\ISystemMountPoint;

class GroupMountPoint extends MountPoint implements ISystemMountPoint {
Expand Down
3 changes: 3 additions & 0 deletions lib/Mount/MountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ public function getMount(
return null;
}
$cacheEntry = $this->getRootFolder()->getStorage()->getCache()->get($folder->getId());
if ($cacheEntry === false) {
return null;
}
}

$storage = $this->getRootFolder()->getStorage();
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<psalm
errorLevel="4"
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down

0 comments on commit 9a07631

Please sign in to comment.