diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-06-22 12:05:26 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-14 17:20:51 +0200 |
commit | 19a36b58a69f9a8cc31da213657fdf828d9fdb3c (patch) | |
tree | 0a1c6b732a0b5548450ae3114e3fe8ebbaf6eb6d /lib/private/Files/SimpleFS/SimpleFolder.php | |
parent | b282fe1e6f5587a6440d170df245ad5acb8dc976 (diff) | |
download | nextcloud-server-19a36b58a69f9a8cc31da213657fdf828d9fdb3c.tar.gz nextcloud-server-19a36b58a69f9a8cc31da213657fdf828d9fdb3c.zip |
Add typing to SimpleFS
- Fix putContent sometimes return a bool and sometimes nothing
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/private/Files/SimpleFS/SimpleFolder.php')
-rw-r--r-- | lib/private/Files/SimpleFS/SimpleFolder.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index cd2a712019e..263c25a8873 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -29,6 +29,7 @@ use OCP\Files\Folder; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\Files\SimpleFS\ISimpleFile; class SimpleFolder implements ISimpleFolder { @@ -44,11 +45,11 @@ class SimpleFolder implements ISimpleFolder { $this->folder = $folder; } - public function getName() { + public function getName(): string { return $this->folder->getName(); } - public function getDirectoryListing() { + public function getDirectoryListing(): array { $listing = $this->folder->getDirectoryListing(); $fileListing = array_map(function (Node $file) { @@ -63,15 +64,15 @@ class SimpleFolder implements ISimpleFolder { return array_values($fileListing); } - public function delete() { + public function delete(): void { $this->folder->delete(); } - public function fileExists($name) { + public function fileExists(string $name): bool { return $this->folder->nodeExists($name); } - public function getFile($name) { + public function getFile(string $name): ISimpleFile { $file = $this->folder->get($name); if (!($file instanceof File)) { @@ -81,7 +82,7 @@ class SimpleFolder implements ISimpleFolder { return new SimpleFile($file); } - public function newFile($name, $content = null) { + public function newFile(string $name, $content = null): ISimpleFile { if ($content === null) { // delay creating the file until it's written to return new NewSimpleFile($this->folder, $name); |