Skip to content

Commit

Permalink
Merge pull request #998 from nextcloud/bugfix/noid/adjust-to-storage-…
Browse files Browse the repository at this point in the history
…changes

fix(storage): Add strong types to storagewrapper
  • Loading branch information
GretaD authored Oct 21, 2024
2 parents 1c045a7 + 7f3b97f commit 4e213aa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/Filesystem/StorageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
namespace OCA\TermsOfService\Filesystem;

use OC\Files\Storage\Wrapper\Wrapper;
use OCP\Files\Cache\ICache;
use OCP\Files\ForbiddenException;
use OCP\Files\Storage\IStorage;

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

public function isCreatable($path) {
public function isCreatable(string $path): bool {
if(!$this->helper->verifyAccess($path)) {
return false;
}

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

public function isUpdatable($path) {
public function isUpdatable(string $path): bool {
if(!$this->helper->verifyAccess($path)) {
return false;
}

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

public function isDeletable($path) {
public function isDeletable(string $path): bool {
if(!$this->helper->verifyAccess($path)) {
return false;
}

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

public function isReadable($path) {
public function isReadable(string $path): bool {
if(!$this->helper->verifyAccess($path)) {
return false;
}

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

public function isSharable($path) {
public function isSharable(string $path): bool {
if(!$this->helper->verifyAccess($path)) {
return false;
}

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

public function fopen($path, $mode) {
public function fopen(string $path, string $mode) {
if ($this->helper->verifyAccess($path)) {
return $this->storage->fopen($path, $mode);
}
Expand All @@ -77,7 +79,7 @@ public function fopen($path, $mode) {
* @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache
* @return \OC\Files\Cache\Cache
*/
public function getCache($path = '', $storage = null) {
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
if (!$storage) {
$storage = $this;
}
Expand Down

0 comments on commit 4e213aa

Please sign in to comment.