From b9ec6adfb2e057bcac25339e21f694569b3ec48b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 4 Apr 2023 16:12:54 +0200 Subject: [PATCH] psalm fixes Signed-off-by: Robin Appelman --- apps/encryption/lib/Command/FixKeyLocation.php | 2 +- apps/encryption/lib/Repair.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/encryption/lib/Command/FixKeyLocation.php b/apps/encryption/lib/Command/FixKeyLocation.php index d1bf36c1e4cb4..a9ffb59864555 100644 --- a/apps/encryption/lib/Command/FixKeyLocation.php +++ b/apps/encryption/lib/Command/FixKeyLocation.php @@ -238,7 +238,7 @@ public function findUserKeyForSystemFileByName(IUser $user, File $node): ?string * * @param string $basePath * @param string $name - * @return \Generator + * @return \Iterator */ public function findKeysByFileName(string $basePath, string $name) { $allKeys = $this->repair->findAllKeysInDirectory($basePath); diff --git a/apps/encryption/lib/Repair.php b/apps/encryption/lib/Repair.php index 1259c03b7dbbf..3b2551156215e 100644 --- a/apps/encryption/lib/Repair.php +++ b/apps/encryption/lib/Repair.php @@ -69,7 +69,9 @@ public function getUserKeyRoot(IUser $user): string { } public function tryReadFile(File $node): bool { - $this->keyStorage->clearKeyCache(); + if ($this->keyStorage instanceof Storage) { + $this->keyStorage->clearKeyCache(); + } try { $fh = $node->fopen('r'); // read a single chunk @@ -265,7 +267,7 @@ public function getKeyPath(IUser $user, Node $node): string { if ($this->needsSystemKey($node->getPath())) { return $this->getSystemKeyPath($node); } else { - return $this->getUserKeyRoot($user, $node); + return $this->getUserKeyRoot($user); } }