From 5d01e0a73c9e27cdec7e51e22ed32707ffca7170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Sun, 15 Sep 2024 18:04:39 +0200 Subject: [PATCH] chore: psalm-suppress legacy code weirdness MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/Files/Storage/Common.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 01b33648ac0..fa8521790f3 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -353,27 +353,37 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { /** * get a propagator instance for the cache * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator + * @param \OC\Files\Storage\Storage $storage (optional) the storage to pass to the watcher + * @return Propagator */ public function getPropagator($storage = null) { if (!$storage) { $storage = $this; } + /** @psalm-suppress NoInterfaceProperties The isset check is safe */ 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; } + /** + * get a propagator instance for the cache + * + * @param \OC\Files\Storage\Storage $storage (optional) the storage to pass to the watcher + * @return Updater + */ public function getUpdater($storage = null) { if (!$storage) { $storage = $this; } + /** @psalm-suppress NoInterfaceProperties The isset check is safe */ 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; }