Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(psalm): Enable psalm level 3 #3686

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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