diff --git a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php index 2f6db935236af..b2be77a3d14c9 100644 --- a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php @@ -26,9 +26,12 @@ namespace OC\Files\ObjectStore; class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage { - /** @var string */ - private $internalId; + private string $internalId; + /** + * @param array{internal-id: int|string} $params + * @throws \Exception + */ public function __construct($params) { if (!isset($params['internal-id'])) { throw new \Exception('missing id in parameters'); @@ -37,7 +40,7 @@ public function __construct($params) { parent::__construct($params); } - public function getId() { + public function getId(): string { return 'object::appdata::preview:' . $this->internalId; } } diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index feceb706e19df..2be17d2e15170 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -26,6 +26,7 @@ */ namespace OC\Files\ObjectStore; +use Exception; use OCP\Files\IHomeStorage; use OCP\IUser; @@ -34,17 +35,19 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements IHomeStorage /** * The home user storage requires a user object to create a unique storage id - * @param array $params + * + * @param array{user: IUser} $params + * @throws Exception */ public function __construct($params) { if (! isset($params['user']) || ! $params['user'] instanceof IUser) { - throw new \Exception('missing user object in parameters'); + throw new Exception('missing user object in parameters'); } $this->user = $params['user']; parent::__construct($params); } - public function getId() { + public function getId(): string { return 'object::user:' . $this->user->getUID(); } @@ -54,7 +57,7 @@ public function getId() { * @param string $path The path to get the owner * @return false|string uid */ - public function getOwner($path) { + public function getOwner($path): bool|string { if (is_object($this->user)) { return $this->user->getUID(); } diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 03af4a86bdb24..d9bc973082a19 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -47,6 +47,7 @@ use OCP\Files\ObjectStore\IObjectStoreMultiPartUpload; use OCP\Files\Storage\IChunkedFileWrite; use OCP\Files\Storage\IStorage; +use OCP\ILogger; class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFileWrite { use CopyDirectory; @@ -55,11 +56,14 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil protected string $id; private string $objectPrefix = 'urn:oid:'; - private $logger; + private ILogger $logger; - /** @var bool */ - protected $validateWrites = true; + protected bool $validateWrites = true; + /** + * @param array{objectstore: IObjectStore, storageid?: string, objectPrefix?: string, validateWrites?: bool} $params + * @throws \Exception + */ public function __construct($params) { if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) { $this->objectStore = $params['objectstore']; diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php index b85f6289c9485..9c3981315359b 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageOverwrite.php @@ -30,7 +30,7 @@ * Allow overwriting the object store instance for test purposes */ class ObjectStoreStorageOverwrite extends ObjectStoreStorage { - public function setObjectStore(IObjectStore $objectStore) { + public function setObjectStore(IObjectStore $objectStore): void { $this->objectStore = $objectStore; } @@ -38,7 +38,7 @@ public function getObjectStore(): IObjectStore { return $this->objectStore; } - public function setValidateWrites(bool $validate) { + public function setValidateWrites(bool $validate): void { $this->validateWrites = $validate; } }