From 9e4c9b97ddf96b1a9379f5bdc5ecd1c24021291c Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20Molakvo=C3=A6?= Date: Fri, 29 Dec 2023 10:16:08 +0100 Subject: [PATCH] fix(psalm): update baseline and suppress unnecessary issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/dav/appinfo/v2/publicremote.php | 7 +++++++ build/psalm-baseline.xml | 6 ------ public.php | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/dav/appinfo/v2/publicremote.php b/apps/dav/appinfo/v2/publicremote.php index f9a3b23e0b8..0ef9bda8dda 100644 --- a/apps/dav/appinfo/v2/publicremote.php +++ b/apps/dav/appinfo/v2/publicremote.php @@ -109,13 +109,20 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct $fileId = $share->getNodeId(); // FIXME: should not add storage wrappers outside of preSetup, need to find a better way + /** @psalm-suppress InternalMethod */ $previousLog = Filesystem::logWarningWhenAddingStorageWrapper(false); + + /** @psalm-suppress MissingClosureParamType */ Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) { return new PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]); }); + + /** @psalm-suppress MissingClosureParamType */ Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) { return new PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]); }); + + /** @psalm-suppress InternalMethod */ Filesystem::logWarningWhenAddingStorageWrapper($previousLog); OC_Util::tearDownFS(); diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 4af64e0bcab..ba529091482 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -105,12 +105,6 @@ $baseuri - - - Filesystem::logWarningWhenAddingStorageWrapper($previousLog) - Filesystem::logWarningWhenAddingStorageWrapper(false) - - CalendarDeletionDefaultUpdaterListener::class diff --git a/public.php b/public.php index 5954da7e3a0..9f3ffcec5e9 100644 --- a/public.php +++ b/public.php @@ -36,7 +36,7 @@ require_once __DIR__ . '/lib/versioncheck.php'; * @param $service * @return string */ -function resolveService($service) { +function resolveService(string $service): string { $services = [ 'webdav' => 'dav/appinfo/v1/publicwebdav.php', 'dav' => 'dav/appinfo/v2/publicremote.php', @@ -74,7 +74,7 @@ try { $file = resolveService($service); - if (is_null($file)) { + if (!$file) { throw new RemoteException('Path not found', 404); } -- 2.39.5