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/public/Files/SimpleFS/InMemoryFile.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/public/Files/SimpleFS/InMemoryFile.php')
-rw-r--r-- | lib/public/Files/SimpleFS/InMemoryFile.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/public/Files/SimpleFS/InMemoryFile.php b/lib/public/Files/SimpleFS/InMemoryFile.php index 590cb43e1d6..393449d4f1f 100644 --- a/lib/public/Files/SimpleFS/InMemoryFile.php +++ b/lib/public/Files/SimpleFS/InMemoryFile.php @@ -36,17 +36,13 @@ use OCP\Files\NotPermittedException; class InMemoryFile implements ISimpleFile { /** * Holds the file name. - * - * @var string */ - private $name; + private string $name; /** * Holds the file contents. - * - * @var string */ - private $contents; + private string $contents; /** * InMemoryFile constructor. @@ -64,7 +60,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getName() { + public function getName(): string { return $this->name; } @@ -72,7 +68,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getSize() { + public function getSize(): int { return strlen($this->contents); } @@ -80,7 +76,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getETag() { + public function getETag(): string { return ''; } @@ -88,7 +84,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getMTime() { + public function getMTime(): int { return time(); } @@ -96,7 +92,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getContent() { + public function getContent(): string { return $this->contents; } @@ -104,7 +100,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function putContent($data) { + public function putContent($data): void { $this->contents = $data; } @@ -113,7 +109,7 @@ class InMemoryFile implements ISimpleFile { * * @since 16.0.0 */ - public function delete() { + public function delete(): void { // unimplemented for in memory files } @@ -121,7 +117,7 @@ class InMemoryFile implements ISimpleFile { * @inheritdoc * @since 16.0.0 */ - public function getMimeType() { + public function getMimeType(): string { $fileInfo = new \finfo(FILEINFO_MIME_TYPE); return $fileInfo->buffer($this->contents); } |