Skip to content

Commit 7f3b97f

Browse files
committed
fix(storage): Add strong types to storagewrapper
Signed-off-by: Joas Schilling <[email protected]>
1 parent 1c045a7 commit 7f3b97f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/Filesystem/StorageWrapper.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
namespace OCA\TermsOfService\Filesystem;
88

99
use OC\Files\Storage\Wrapper\Wrapper;
10+
use OCP\Files\Cache\ICache;
1011
use OCP\Files\ForbiddenException;
12+
use OCP\Files\Storage\IStorage;
1113

1214
class StorageWrapper extends Wrapper {
1315
/** @var string */
@@ -22,47 +24,47 @@ public function __construct($parameters) {
2224
$this->helper = new Helper($parameters['checker'], $this->mountPoint);
2325
}
2426

25-
public function isCreatable($path) {
27+
public function isCreatable(string $path): bool {
2628
if(!$this->helper->verifyAccess($path)) {
2729
return false;
2830
}
2931

3032
return $this->storage->isCreatable($path);
3133
}
3234

33-
public function isUpdatable($path) {
35+
public function isUpdatable(string $path): bool {
3436
if(!$this->helper->verifyAccess($path)) {
3537
return false;
3638
}
3739

3840
return $this->storage->isUpdatable($path);
3941
}
4042

41-
public function isDeletable($path) {
43+
public function isDeletable(string $path): bool {
4244
if(!$this->helper->verifyAccess($path)) {
4345
return false;
4446
}
4547

4648
return $this->storage->isDeletable($path);
4749
}
4850

49-
public function isReadable($path) {
51+
public function isReadable(string $path): bool {
5052
if(!$this->helper->verifyAccess($path)) {
5153
return false;
5254
}
5355

5456
return $this->storage->isReadable($path);
5557
}
5658

57-
public function isSharable($path) {
59+
public function isSharable(string $path): bool {
5860
if(!$this->helper->verifyAccess($path)) {
5961
return false;
6062
}
6163

6264
return $this->storage->isReadable($path);
6365
}
6466

65-
public function fopen($path, $mode) {
67+
public function fopen(string $path, string $mode) {
6668
if ($this->helper->verifyAccess($path)) {
6769
return $this->storage->fopen($path, $mode);
6870
}
@@ -77,7 +79,7 @@ public function fopen($path, $mode) {
7779
* @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
7880
* @return \OC\Files\Cache\Cache
7981
*/
80-
public function getCache($path = '', $storage = null) {
82+
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
8183
if (!$storage) {
8284
$storage = $this;
8385
}

0 commit comments

Comments
 (0)