diff --git a/lib/ACL/ACLStorageWrapper.php b/lib/ACL/ACLStorageWrapper.php index c862a2019..5878f0735 100644 --- a/lib/ACL/ACLStorageWrapper.php +++ b/lib/ACL/ACLStorageWrapper.php @@ -43,33 +43,33 @@ private function checkPermissions(string $path, int $permissions): bool { return ($this->getACLPermissionsForPath($path) & $permissions) === $permissions; } - public function isReadable($path): bool { + public function isReadable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::isReadable($path); } - public function isUpdatable($path): bool { + public function isUpdatable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_UPDATE) && parent::isUpdatable($path); } - public function isCreatable($path): bool { + public function isCreatable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::isCreatable($path); } - public function isDeletable($path): bool { + public function isDeletable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::isDeletable($path); } - public function isSharable($path): bool { + public function isSharable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_SHARE) && parent::isSharable($path); } - public function getPermissions($path): int { + public function getPermissions(string $path): int { return $this->storage->getPermissions($path) & $this->getACLPermissionsForPath($path); } - public function rename($source, $target): bool { + public function rename(string $source, string $target): bool { if (str_starts_with($source, $target)) { $part = substr($source, strlen($target)); //This is a rename of the transfer file to the original file @@ -96,7 +96,7 @@ public function rename($source, $target): bool { parent::rename($source, $target); } - public function opendir($path) { + public function opendir(string $path) { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -118,29 +118,29 @@ public function opendir($path) { return IteratorDirectory::wrap($items); } - public function copy($source, $target): bool { + public function copy(string $source, string $target): bool { $permissions = $this->file_exists($target) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($target, $permissions) && $this->checkPermissions($source, Constants::PERMISSION_READ) && parent::copy($source, $target); } - public function touch($path, $mtime = null): bool { + public function touch(string $path, ?int $mtime = null): bool { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($path, $permissions) && parent::touch($path, $mtime); } - public function mkdir($path): bool { + public function mkdir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::mkdir($path); } - public function rmdir($path): bool { + public function rmdir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::rmdir($path); } - public function unlink($path): bool { + public function unlink(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::unlink($path); @@ -154,12 +154,12 @@ private function canDeleteTree(string $path): int { return $this->aclManager->getPermissionsForTree($path) & Constants::PERMISSION_DELETE; } - public function file_put_contents($path, $data): int|float|false { + public function file_put_contents(string $path, mixed $data): int|float|false { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($path, $permissions) ? parent::file_put_contents($path, $data) : false; } - public function fopen($path, $mode) { + public function fopen(string $path, string $mode) { if ($mode === 'r' or $mode === 'rb') { $permissions = Constants::PERMISSION_READ; } else { @@ -189,7 +189,7 @@ public function getCache($path = '', $storage = null): ICache { return new ACLCacheWrapper($sourceCache, $this->aclManager, $this->inShare); } - public function getMetaData($path): ?array { + public function getMetaData(string $path): ?array { $data = parent::getMetaData($path); if ($data && isset($data['permissions'])) { @@ -213,17 +213,17 @@ public function getScanner($path = '', $storage = null): IScanner { return parent::getScanner($path, $storage); } - public function is_dir($path): bool { + public function is_dir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::is_dir($path); } - public function is_file($path): bool { + public function is_file(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::is_file($path); } - public function stat($path): array|false { + public function stat(string $path): array|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -231,7 +231,7 @@ public function stat($path): array|false { return parent::stat($path); } - public function filetype($path): string|false { + public function filetype(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -239,7 +239,7 @@ public function filetype($path): string|false { return parent::filetype($path); } - public function filesize($path): false|int|float { + public function filesize(string $path): false|int|float { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -247,12 +247,12 @@ public function filesize($path): false|int|float { return parent::filesize($path); } - public function file_exists($path): bool { + public function file_exists(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::file_exists($path); } - public function filemtime($path): int|false { + public function filemtime(string $path): int|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -260,7 +260,7 @@ public function filemtime($path): int|false { return parent::filemtime($path); } - public function file_get_contents($path): string|false { + public function file_get_contents(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -268,7 +268,7 @@ public function file_get_contents($path): string|false { return parent::file_get_contents($path); } - public function getMimeType($path): string|false { + public function getMimeType(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -276,7 +276,7 @@ public function getMimeType($path): string|false { return parent::getMimeType($path); } - public function hash($type, $path, $raw = false): string|false { + public function hash(string $type, string $path, bool $raw = false): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -284,7 +284,7 @@ public function hash($type, $path, $raw = false): string|false { return parent::hash($type, $path, $raw); } - public function getETag($path): string|false { + public function getETag(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -292,7 +292,7 @@ public function getETag($path): string|false { return parent::getETag($path); } - public function getDirectDownload($path): array|false { + public function getDirectDownload(string $path): array|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -300,7 +300,7 @@ public function getDirectDownload($path): array|false { return parent::getDirectDownload($path); } - public function getDirectoryContent($directory): \Traversable { + public function getDirectoryContent(string $directory): \Traversable { $content = $this->getWrapperStorage()->getDirectoryContent($directory); foreach ($content as $data) { $data['scan_permissions'] ??= $data['permissions']; diff --git a/lib/Command/Trashbin/Cleanup.php b/lib/Command/Trashbin/Cleanup.php index 71e71f3f3..8f1611402 100644 --- a/lib/Command/Trashbin/Cleanup.php +++ b/lib/Command/Trashbin/Cleanup.php @@ -13,6 +13,7 @@ use OCA\GroupFolders\Trash\TrashBackend; use OCP\App\IAppManager; use OCP\Server; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -46,6 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return -1; } + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $folders = $this->folderManager->getAllFolders(); diff --git a/lib/Mount/GroupFolderStorage.php b/lib/Mount/GroupFolderStorage.php index 18670f99e..9227fca84 100644 --- a/lib/Mount/GroupFolderStorage.php +++ b/lib/Mount/GroupFolderStorage.php @@ -38,7 +38,7 @@ public function getFolderId(): int { return $this->folderId; } - public function getOwner($path): string|false { + public function getOwner(string $path): string|false { $user = $this->userSession->getUser(); if ($user !== null) { return $user->getUID(); diff --git a/lib/Mount/RootPermissionsMask.php b/lib/Mount/RootPermissionsMask.php index 62e19e474..5f593b5ce 100644 --- a/lib/Mount/RootPermissionsMask.php +++ b/lib/Mount/RootPermissionsMask.php @@ -37,7 +37,7 @@ private function checkMask(int $permissions): bool { return ($this->mask & $permissions) === $permissions; } - public function isUpdatable($path): bool { + public function isUpdatable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path); } else { @@ -45,7 +45,7 @@ public function isUpdatable($path): bool { } } - public function isCreatable($path): bool { + public function isCreatable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path); } else { @@ -53,7 +53,7 @@ public function isCreatable($path): bool { } } - public function isDeletable($path): bool { + public function isDeletable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path); } else { @@ -61,7 +61,7 @@ public function isDeletable($path): bool { } } - public function isSharable($path): bool { + public function isSharable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($path); } else { @@ -69,7 +69,7 @@ public function isSharable($path): bool { } } - public function getPermissions($path): int { + public function getPermissions(string $path): int { if ($path === '') { return $this->storage->getPermissions($path) & $this->mask; } else { @@ -77,7 +77,7 @@ public function getPermissions($path): int { } } - public function getMetaData($path): ?array { + public function getMetaData(string $path): ?array { $data = parent::getMetaData($path); if ($data && $path === '' && isset($data['permissions'])) {