diff --git a/composer.lock b/composer.lock index c396a3f2..8f4698b5 100644 --- a/composer.lock +++ b/composer.lock @@ -858,12 +858,12 @@ "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "5460600953d265eb408baa990102b7ffb5c47134" + "reference": "95de3516904b65613a8fb226874f967bedbd932f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/5460600953d265eb408baa990102b7ffb5c47134", - "reference": "5460600953d265eb408baa990102b7ffb5c47134", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/95de3516904b65613a8fb226874f967bedbd932f", + "reference": "95de3516904b65613a8fb226874f967bedbd932f", "shasum": "" }, "require": { @@ -877,7 +877,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "30.0.0-dev" + "dev-master": "31.0.0-dev" } }, "notification-url": "https://packagist.org/downloads/", @@ -895,7 +895,7 @@ "issues": "https://github.com/nextcloud-deps/ocp/issues", "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2024-07-11T00:37:32+00:00" + "time": "2024-10-01T00:48:14+00:00" }, { "name": "nikic/php-parser", diff --git a/lib/FilteredNavigationManager.php b/lib/FilteredNavigationManager.php index b93f9211..a92e12fc 100644 --- a/lib/FilteredNavigationManager.php +++ b/lib/FilteredNavigationManager.php @@ -69,4 +69,23 @@ public function setActiveEntry($appId): void { public function setUnreadCounter(string $id, int $unreadCounter): void { $this->navigationManager->setUnreadCounter($id, $unreadCounter); } + + public function get(string $id): ?array { + return $this->navigationManager->get($id); + } + + public function getDefaultEntryIdForUser(?IUser $user = null, bool $withFallbacks = true): string { + return $this->navigationManager->getDefaultEntryIdForUser($user, $withFallbacks); + } + + public function getDefaultEntryIds(bool $withFallbacks = true): array { + return $this->navigationManager->getDefaultEntryIds($withFallbacks); + } + + /** + * @psalm-suppress MethodSignatureMismatch + */ + public function setDefaultEntryIds(array $ids): void { + $this->navigationManager->setDefaultEntryIds($ids); + } } diff --git a/lib/RestrictionManager.php b/lib/RestrictionManager.php index 60ee34d3..31ac7efb 100644 --- a/lib/RestrictionManager.php +++ b/lib/RestrictionManager.php @@ -100,7 +100,7 @@ public function setupRestrictions(): void { } /** @var NavigationManager $navManager */ - $navManager = $this->server->getNavigationManager(); + $navManager = \OCP\Server::get(INavigationManager::class); $this->server->registerService(INavigationManager::class, function () use ($navManager) { return new FilteredNavigationManager($this->userSession->getUser(), $navManager, $this->whitelist); diff --git a/lib/Storage/DirMask.php b/lib/Storage/DirMask.php index 967cf918..b11f6a10 100644 --- a/lib/Storage/DirMask.php +++ b/lib/Storage/DirMask.php @@ -22,6 +22,7 @@ namespace OCA\Guests\Storage; use OC\Files\Storage\Wrapper\PermissionsMask; +use OCP\Files\Cache\ICache; /** * While PermissionMask can mask a whole storage this can @@ -100,9 +101,6 @@ public function getPermissions($path): int { } } - /** - * @psalm-suppress ParamNameMismatch - */ public function rename($source, $target): bool { if (!$this->isUpdatable($source)) { return false; @@ -123,9 +121,6 @@ public function rename($source, $target): bool { return false; } - /** - * @psalm-suppress ParamNameMismatch - */ public function copy($source, $target): bool { if (!$this->isReadable($source)) { return false; @@ -162,10 +157,7 @@ public function mkdir($path): bool { } } - /** - * @psalm-suppress MethodSignatureMustProvideReturnType - */ - public function rmdir($path) { + public function rmdir($path): bool { if ($this->checkPath($path)) { return parent::rmdir($path); } else { @@ -181,10 +173,7 @@ public function unlink($path): bool { } } - /** - * @psalm-suppress MethodSignatureMustProvideReturnType - */ - public function file_put_contents($path, $data) { + public function file_put_contents($path, $data): int|float|false { if ($this->checkPath($path)) { return parent::file_put_contents($path, $data); } else { @@ -192,9 +181,6 @@ public function file_put_contents($path, $data) { } } - /** - * @psalm-suppress MethodSignatureMustProvideReturnType - */ public function fopen($path, $mode) { if ($this->checkPath($path)) { return parent::fopen($path, $mode); @@ -203,10 +189,7 @@ public function fopen($path, $mode) { } } - /** - * @psalm-suppress MethodSignatureMustProvideReturnType - */ - public function getCache($path = '', $storage = null) { + public function getCache($path = '', $storage = null): ICache { if (!$storage) { $storage = $this; } diff --git a/tests/stub.php b/tests/stub.php index 47f270f1..9645ee27 100644 --- a/tests/stub.php +++ b/tests/stub.php @@ -127,6 +127,18 @@ public function getAll(string $type = self::TYPE_APPS): array { */ public function setUnreadCounter(string $id, int $unreadCounter): void { } + + public function get(string $id): ?array { + } + + public function getDefaultEntryIdForUser(?\OCP\IUser $user = null, bool $withFallbacks = true): string { + } + + public function getDefaultEntryIds(bool $withFallbacks = true): array { + } + + public function setDefaultEntryIds(array $ids): void { + } } class AppConfig { @@ -575,7 +587,14 @@ public function getMountType() { namespace OC\Files\Storage\Wrapper{ + use OCP\Files\Cache\ICache; + use OCP\Files\Cache\IPropagator; + use OCP\Files\Cache\IScanner; + use OCP\Files\Cache\IUpdater; + use OCP\Files\Cache\IWatcher; + use OCP\Files\Storage; use OCP\Files\Storage\IStorage; + use OCP\Lock\ILockingProvider; class Wrapper implements IStorage { /** @@ -583,189 +602,196 @@ class Wrapper implements IStorage { */ protected $storage; - - public function __construct(array $parameters) { + /** + * @param array $parameters + */ + public function __construct($parameters) { } - public function getWrapperStorage(): ?IStorage { + public function getWrapperStorage(): IStorage { } - public function getId() { + public function getId(): string { } - public function mkdir($path) { + public function mkdir($path): bool { } - public function rmdir($path) { + public function rmdir($path): bool { } public function opendir($path) { - throw new \Exception('stub'); } - public function is_dir($path) { - throw new \Exception('stub'); + public function is_dir($path): bool { } - public function is_file($path) { - throw new \Exception('stub'); + public function is_file($path): bool { } - public function stat($path) { - throw new \Exception('stub'); + public function stat($path): array|false { } - public function filetype($path) { - throw new \Exception('stub'); + public function filetype($path): string|false { } - public function filesize($path) { - throw new \Exception('stub'); + public function filesize($path): int|float|false { } - public function isCreatable($path) { - throw new \Exception('stub'); + public function isCreatable($path): bool { } - public function isReadable($path) { - throw new \Exception('stub'); + public function isReadable($path): bool { } - public function isUpdatable($path) { - throw new \Exception('stub'); + public function isUpdatable($path): bool { } - public function isDeletable($path) { - throw new \Exception('stub'); + public function isDeletable($path): bool { } - public function isSharable($path) { - throw new \Exception('stub'); + public function isSharable($path): bool { } - public function getPermissions($path) { - throw new \Exception('stub'); + public function getPermissions($path): int { } - public function file_exists($path) { - throw new \Exception('stub'); + public function file_exists($path): bool { } - public function filemtime($path) { - throw new \Exception('stub'); + public function filemtime($path): int|false { } - public function file_get_contents($path) { - throw new \Exception('stub'); + public function file_get_contents($path): string|false { } - public function file_put_contents($path, $data) { - throw new \Exception('stub'); + public function file_put_contents($path, $data): int|float|false { } - public function unlink($path) { - throw new \Exception('stub'); + public function unlink($path): bool { } - public function rename($path1, $path2) { - throw new \Exception('stub'); + public function rename($source, $target): bool { } - public function copy($path1, $path2) { - throw new \Exception('stub'); + public function copy($source, $target): bool { } public function fopen($path, $mode) { - throw new \Exception('stub'); } - public function getMimeType($path) { - throw new \Exception('stub'); + public function getMimeType($path): string|false { } - public function hash($type, $path, $raw = false) { - throw new \Exception('stub'); + public function hash($type, $path, $raw = false): string|false { } - public function free_space($path) { - throw new \Exception('stub'); + public function free_space($path): int|float|false { } - public function touch($path, $mtime = null) { - throw new \Exception('stub'); + public function touch($path, $mtime = null): bool { } - public function getLocalFile($path) { - throw new \Exception('stub'); + public function getLocalFile($path): string|false { } - public function hasUpdated($path, $time) { - throw new \Exception('stub'); + public function hasUpdated($path, $time): bool { } - public function getETag($path) { - throw new \Exception('stub'); + public function getCache($path = '', $storage = null): ICache { } - public function isLocal() { - throw new \Exception('stub'); + public function getScanner($path = '', $storage = null): IScanner { } - public function instanceOfStorage($class) { - throw new \Exception('stub'); + public function getOwner($path): string|false { } - public function getDirectDownload($path) { - throw new \Exception('stub'); + public function getWatcher($path = '', $storage = null): IWatcher { } - public function verifyPath($path, $fileName) { - throw new \Exception('stub'); + public function getPropagator($storage = null): IPropagator { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { - throw new \Exception('stub'); + public function getUpdater($storage = null): IUpdater { } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { - throw new \Exception('stub'); + public function getStorageCache(): \OC\Files\Cache\Storage { } - public function test() { - throw new \Exception('stub'); + public function getETag($path): string|false { } - public function getAvailability() { - throw new \Exception('stub'); + public function test(): bool { } - public function setAvailability($isAvailable) { - throw new \Exception('stub'); + public function isLocal(): bool { } - public function getOwner($path) { - throw new \Exception('stub'); + public function instanceOfStorage($class): bool { } - public function getCache() { - throw new \Exception('stub'); + /** + * @psalm-template T of IStorage + * @psalm-param class-string $class + * @psalm-return T|null + */ + public function getInstanceOfStorage(string $class): ?IStorage { } - public function getPropagator() { - throw new \Exception('stub'); + /** + * Pass any methods custom to specific storage implementations to the wrapped storage + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) { } - public function getScanner() { - throw new \Exception('stub'); + public function getDirectDownload($path): array|false { + } + + public function getAvailability(): array { + } + + public function setAvailability($isAvailable): void { + } + + public function verifyPath($path, $fileName): void { + } + + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool { + } + + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool { + } + + public function getMetaData($path): ?array { + } + + public function acquireLock($path, $type, ILockingProvider $provider): void { + } + + public function releaseLock($path, $type, ILockingProvider $provider): void { + } + + public function changeLock($path, $type, ILockingProvider $provider): void { + } + + public function needsPartFile(): bool { + } + + public function writeStream(string $path, $stream, ?int $size = null): int { } - public function getUpdater() { + public function getDirectoryContent($directory): \Traversable { } - public function getWatcher() { + public function isWrapperOf(IStorage $storage): bool { } - public function setOwner(?string $user) : void { + public function setOwner(?string $user): void { } }