diff --git a/lib/Mount/GroupFolderStorage.php b/lib/Mount/GroupFolderStorage.php index 36c0df4bb..065d9537b 100644 --- a/lib/Mount/GroupFolderStorage.php +++ b/lib/Mount/GroupFolderStorage.php @@ -34,10 +34,7 @@ public function getFolderId(): int { return $this->folderId; } - /** - * @psalm-suppress FalsableReturnStatement Return type of getOwner is not clear even in server - */ - public function getOwner($path) { + public function getOwner($path): string|false { $user = $this->userSession->getUser(); if ($user !== null) { return $user->getUID(); diff --git a/tests/stubs/oc_files_cache_scanner.php b/tests/stubs/oc_files_cache_scanner.php index 471693932..716507377 100644 --- a/tests/stubs/oc_files_cache_scanner.php +++ b/tests/stubs/oc_files_cache_scanner.php @@ -15,6 +15,7 @@ use OCP\Files\Cache\IScanner; use OCP\Files\ForbiddenException; use OCP\Files\NotFoundException; +use OCP\Files\Storage\ILockingStorage; use OCP\Files\Storage\IReliableEtagStorage; use OCP\IDBConnection; use OCP\Lock\ILockingProvider; diff --git a/tests/stubs/oc_files_objectstore_objectstorestorage.php b/tests/stubs/oc_files_objectstore_objectstorestorage.php index d646e5e10..650b75947 100644 --- a/tests/stubs/oc_files_objectstore_objectstorestorage.php +++ b/tests/stubs/oc_files_objectstore_objectstorestorage.php @@ -48,10 +48,6 @@ public function mkdir($path, bool $force = false) /** * Object Stores use a NoopScanner because metadata is directly stored in * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\ObjectStore\ObjectStoreScanner */ public function getScanner($path = '', $storage = null) { diff --git a/tests/stubs/oc_files_storage_common.php b/tests/stubs/oc_files_storage_common.php index 32d414cdd..99df515d2 100644 --- a/tests/stubs/oc_files_storage_common.php +++ b/tests/stubs/oc_files_storage_common.php @@ -44,14 +44,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { use LocalTempFileTrait; - protected $cache; - protected $scanner; - protected $watcher; - protected $propagator; + protected ?Cache $cache = null; + protected ?Scanner $scanner = null; + protected ?Watcher $watcher = null; + protected ?Propagator $propagator = null; protected $storageCache; - protected $updater; + protected ?Updater $updater = null; - protected $mountOptions = []; + protected array $mountOptions = []; protected $owner = null; public function __construct($parameters) { @@ -129,10 +129,6 @@ public function getMimeType($path) public function hash($type, $path, $raw = false) { - } - - public function search($query) - { } public function getLocalFile($path) @@ -168,6 +164,9 @@ protected function getCacheDependencies(): CacheDependencies { } + /** + * @return Cache + */ public function getCache($path = '', $storage = null) { } @@ -180,16 +179,16 @@ public function getWatcher($path = '', $storage = null) { } - /** - * 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 - */ public function getPropagator($storage = null) { } + /** + * 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) { } @@ -198,13 +197,7 @@ public function getStorageCache($storage = null) { } - /** - * get the owner of a path - * - * @param string $path The path to get the owner - * @return string|false uid or false - */ - public function getOwner($path) + public function getOwner($path): string|false { } @@ -330,39 +323,18 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t { } - /** - * @inheritdoc - */ public function getMetaData($path) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function releaseLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function changeLock($path, $type, ILockingProvider $provider) { } diff --git a/tests/stubs/oc_files_storage_storage.php b/tests/stubs/oc_files_storage_storage.php index fb239aa84..a55f955de 100644 --- a/tests/stubs/oc_files_storage_storage.php +++ b/tests/stubs/oc_files_storage_storage.php @@ -5,75 +5,58 @@ * SPDX-FileCopyrightText: 2016 ownCloud, Inc. * SPDX-License-Identifier: AGPL-3.0-only */ + namespace OC\Files\Storage; -use OCP\Lock\ILockingProvider; +use OC\Files\Cache\Cache; +use OC\Files\Cache\Propagator; +use OC\Files\Cache\Scanner; +use OC\Files\Cache\Updater; +use OC\Files\Cache\Watcher; +use OCP\Files\Storage\ILockingStorage; +use OCP\Files\Storage\IStorage; /** * Provide a common interface to all different storage options * * All paths passed to the storage are relative to the storage and should NOT have a leading slash. */ -interface Storage extends \OCP\Files\Storage { +interface Storage extends IStorage, ILockingStorage { /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache + * @inheritDoc + * @return Cache */ public function getCache($path = '', $storage = null) { } /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner + * @inheritDoc + * @return Scanner */ public function getScanner($path = '', $storage = null) { } - - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) - { - } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher + * @inheritDoc + * @return Watcher */ public function getWatcher($path = '', $storage = null) { } /** - * 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 + * @inheritDoc + * @return Propagator */ public function getPropagator($storage = null) { } /** - * get a updater instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Updater + * @inheritDoc + * @return Updater */ public function getUpdater($storage = null) { @@ -92,36 +75,6 @@ public function getStorageCache() */ public function getMetaData($path) { - } - - /** - * @param string $path The path of the file to acquire the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function acquireLock($path, $type, ILockingProvider $provider) - { - } - - /** - * @param string $path The path of the file to release the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function releaseLock($path, $type, ILockingProvider $provider) - { - } - - /** - * @param string $path The path of the file to change the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function changeLock($path, $type, ILockingProvider $provider) - { } /** diff --git a/tests/stubs/oc_files_storage_wrapper_jail.php b/tests/stubs/oc_files_storage_wrapper_jail.php index 02a5a559f..937da97e3 100644 --- a/tests/stubs/oc_files_storage_wrapper_jail.php +++ b/tests/stubs/oc_files_storage_wrapper_jail.php @@ -311,16 +311,6 @@ public function hash($type, $path, $raw = false) */ public function free_space($path) { - } - - /** - * search for occurrences of $query in file names - * - * @param string $query - * @return array|bool - */ - public function search($query) - { } /** @@ -360,34 +350,14 @@ public function hasUpdated($path, $time) { } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ public function getCache($path = '', $storage = null) { } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) + public function getOwner($path): string|false { } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ public function getWatcher($path = '', $storage = null) { } @@ -406,30 +376,14 @@ public function getMetaData($path) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function releaseLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function changeLock($path, $type, ILockingProvider $provider) { } diff --git a/tests/stubs/oc_files_storage_wrapper_permissionsmask.php b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php index fb662e374..665601323 100644 --- a/tests/stubs/oc_files_storage_wrapper_permissionsmask.php +++ b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php @@ -80,13 +80,6 @@ public function fopen($path, $mode) { } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ public function getCache($path = '', $storage = null) { } diff --git a/tests/stubs/oc_files_storage_wrapper_wrapper.php b/tests/stubs/oc_files_storage_wrapper_wrapper.php index 7af2696c4..8b9fcb456 100644 --- a/tests/stubs/oc_files_storage_wrapper_wrapper.php +++ b/tests/stubs/oc_files_storage_wrapper_wrapper.php @@ -308,16 +308,6 @@ public function hash($type, $path, $raw = false) */ public function free_space($path) { - } - - /** - * search for occurrences of $query in file names - * - * @param string $query - * @return array|bool - */ - public function search($query) - { } /** @@ -357,46 +347,18 @@ public function hasUpdated($path, $time) { } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ public function getCache($path = '', $storage = null) { } - /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner - */ public function getScanner($path = '', $storage = null) { } - - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) + public function getOwner($path): string|false { } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ public function getWatcher($path = '', $storage = null) { } @@ -409,9 +371,6 @@ public function getUpdater($storage = null) { } - /** - * @return \OC\Files\Cache\Storage - */ public function getStorageCache() { } @@ -538,30 +497,14 @@ public function getMetaData($path) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ public function acquireLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function releaseLock($path, $type, ILockingProvider $provider) { } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ public function changeLock($path, $type, ILockingProvider $provider) { } diff --git a/tests/stubs/oc_files_view.php b/tests/stubs/oc_files_view.php index b1e91fd0f..75d108d4f 100644 --- a/tests/stubs/oc_files_view.php +++ b/tests/stubs/oc_files_view.php @@ -28,6 +28,7 @@ use OCP\Files\NotFoundException; use OCP\Files\ReservedWordException; use OCP\IUser; +use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Lock\LockedException; use OCP\Server; @@ -542,11 +543,9 @@ public function searchByTag($tag, $userId) /** * Get the owner for a file or folder * - * @param string $path - * @return string the user id of the owner * @throws NotFoundException */ - public function getOwner($path) + public function getOwner(string $path): string { } diff --git a/tests/stubs/oc_server.php b/tests/stubs/oc_server.php index 36840889d..08927f9b9 100644 --- a/tests/stubs/oc_server.php +++ b/tests/stubs/oc_server.php @@ -11,7 +11,6 @@ use OC\App\AppManager; use OC\App\AppStore\Bundles\BundleFetcher; use OC\App\AppStore\Fetcher\AppFetcher; -use OC\App\AppStore\Fetcher\CategoryFetcher; use OC\AppFramework\Bootstrap\Coordinator; use OC\AppFramework\Http\Request; use OC\AppFramework\Http\RequestId; @@ -112,7 +111,6 @@ use OC\Share20\ShareHelper; use OC\SpeechToText\SpeechToTextManager; use OC\SystemTag\ManagerFactory as SystemTagManagerFactory; -use OC\Tagging\TagMapper; use OC\Talk\Broker; use OC\Teams\TeamManager; use OC\Template\JSCombiner;