aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-09-16 18:07:03 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-09-16 18:11:39 +0200
commite7ac9bb2d8a14ccbf3305de4af851ed1476b205e (patch)
tree561c805d7b5ea3f98e3895f2ee7823e7630247cc
parented0ac284e3e56e77f68594b834e4f04abe7ad846 (diff)
downloadnextcloud-server-fix/remove-references-to-deprected-storage-interface.tar.gz
nextcloud-server-fix/remove-references-to-deprected-storage-interface.zip
chore: Check storage is an instance of the correct class instead of psalm-suppressfix/remove-references-to-deprected-storage-interface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--lib/private/Files/Storage/Common.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 80e39fa9b93..eb93ab89bc7 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -326,11 +326,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (!$storage) {
$storage = $this;
}
- /** @psalm-suppress NoInterfaceProperties The isset check is safe */
+ if (!$storage->instanceOfStorage(self::class)) {
+ throw new \InvalidArgumentException('Storage is not of the correct class');
+ }
if (!isset($storage->scanner)) {
$storage->scanner = new Scanner($storage);
}
- /** @psalm-suppress NoInterfaceProperties Legacy stuff */
return $storage->scanner;
}
@@ -356,12 +357,13 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (!$storage) {
$storage = $this;
}
- /** @psalm-suppress NoInterfaceProperties The isset check is safe */
+ if (!$storage->instanceOfStorage(self::class)) {
+ throw new \InvalidArgumentException('Storage is not of the correct class');
+ }
if (!isset($storage->propagator)) {
$config = \OC::$server->getSystemConfig();
$storage->propagator = new Propagator($storage, \OC::$server->getDatabaseConnection(), ['appdata_' . $config->getValue('instanceid')]);
}
- /** @psalm-suppress NullableReturnStatement False-positive, as the if above avoids this being null */
return $storage->propagator;
}
@@ -375,11 +377,12 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
if (!$storage) {
$storage = $this;
}
- /** @psalm-suppress NoInterfaceProperties The isset check is safe */
+ if (!$storage->instanceOfStorage(self::class)) {
+ throw new \InvalidArgumentException('Storage is not of the correct class');
+ }
if (!isset($storage->updater)) {
$storage->updater = new Updater($storage);
}
- /** @psalm-suppress NullableReturnStatement False-positive, as the if above avoids this being null */
return $storage->updater;
}