diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-19 18:18:15 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-26 17:29:22 +0200 |
commit | 0356e9e82f8a16057dffd78a3436c5a2558533bc (patch) | |
tree | b1e04a4739c3147ecc91858b729e80826eb632c8 /apps/files_trashbin | |
parent | 0451be763bbd1c85a393c75628e9f9c4b9c7dcd3 (diff) | |
download | nextcloud-server-0356e9e82f8a16057dffd78a3436c5a2558533bc.tar.gz nextcloud-server-0356e9e82f8a16057dffd78a3436c5a2558533bc.zip |
fix(files_trashbin): Fix all IStorage return types
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/Storage.php | 32 | ||||
-rw-r--r-- | apps/files_trashbin/tests/StorageTest.php | 4 |
2 files changed, 11 insertions, 25 deletions
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index c05d248c9d0..23a0e5bd919 100644 --- a/apps/files_trashbin/lib/Storage.php +++ b/apps/files_trashbin/lib/Storage.php @@ -48,14 +48,7 @@ class Storage extends Wrapper { parent::__construct($parameters); } - /** - * Deletes the given file by moving it into the trashbin. - * - * @param string $path path of file or folder to delete - * - * @return bool true if the operation succeeded, false otherwise - */ - public function unlink($path) { + public function unlink($path): bool { if ($this->trashEnabled) { try { return $this->doDelete($path, 'unlink'); @@ -72,14 +65,7 @@ class Storage extends Wrapper { } } - /** - * Deletes the given folder by moving it into the trashbin. - * - * @param string $path path of folder to delete - * - * @return bool true if the operation succeeded, false otherwise - */ - public function rmdir($path) { + public function rmdir($path): bool { if ($this->trashEnabled) { return $this->doDelete($path, 'rmdir'); } else { @@ -94,7 +80,7 @@ class Storage extends Wrapper { * @param $path * @return bool */ - protected function shouldMoveToTrash($path) { + protected function shouldMoveToTrash($path): bool { $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); $parts = explode('/', $normalized); if (count($parts) < 4 || strpos($normalized, '/appdata_') === 0) { @@ -132,7 +118,7 @@ class Storage extends Wrapper { * @param Node $node * @return MoveToTrashEvent */ - protected function createMoveToTrashEvent(Node $node) { + protected function createMoveToTrashEvent(Node $node): MoveToTrashEvent { return new MoveToTrashEvent($node); } @@ -144,7 +130,7 @@ class Storage extends Wrapper { * * @return bool true if the operation succeeded, false otherwise */ - private function doDelete($path, $method) { + private function doDelete($path, $method): bool { if ( !\OC::$server->getAppManager()->isEnabledForUser('files_trashbin') || (pathinfo($path, PATHINFO_EXTENSION) === 'part') @@ -170,7 +156,7 @@ class Storage extends Wrapper { /** * Setup the storage wrapper callback */ - public static function setupStorage() { + public static function setupStorage(): void { $trashManager = \OC::$server->get(ITrashManager::class); $userManager = \OC::$server->get(IUserManager::class); $logger = \OC::$server->get(LoggerInterface::class); @@ -195,7 +181,7 @@ class Storage extends Wrapper { return $this->mountPoint; } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool { $sourceIsTrashbin = $sourceStorage->instanceOfStorage(Storage::class); try { // the fallback for moving between storage involves a copy+delete @@ -219,11 +205,11 @@ class Storage extends Wrapper { } } - protected function disableTrash() { + protected function disableTrash(): void { $this->trashEnabled = false; } - protected function enableTrash() { + protected function enableTrash(): void { $this->trashEnabled = true; } } diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index f0f3159b32a..9de4bf0cc13 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -29,11 +29,11 @@ use Psr\Log\LoggerInterface; use Test\Traits\MountProviderTrait; class TemporaryNoCross extends Temporary { - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null) { + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null): bool { return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime); } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool { return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); } } |