Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Storage): Fix getDirectoryContent() return type #48454

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
return $count;
}

public function getDirectoryContent($directory): \Traversable|false {
public function getDirectoryContent($directory): \Traversable {
$dh = $this->opendir($directory);

if ($dh === false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ public function getMetaData($path): ?array;
* - storage_mtime
* - permissions
*/
public function getDirectoryContent($directory): \Traversable|false;
public function getDirectoryContent($directory): \Traversable;
}
4 changes: 2 additions & 2 deletions lib/private/Files/Storage/Wrapper/Availability.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,13 @@ protected function setUnavailable(?StorageNotAvailableException $e): void {



public function getDirectoryContent($directory): \Traversable|false {
public function getDirectoryContent($directory): \Traversable {
$this->checkAvailability();
try {
return parent::getDirectoryContent($directory);
} catch (StorageNotAvailableException $e) {
$this->setUnavailable($e);
return false;
return new \EmptyIterator();
}
}
}
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Wrapper/Jail.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
}
}

public function getDirectoryContent($directory): \Traversable|false {
public function getDirectoryContent($directory): \Traversable {
return $this->getWrapperStorage()->getDirectoryContent($this->getUnjailedPath($directory));
}
}
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Wrapper/Wrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
}
}

public function getDirectoryContent($directory): \Traversable|false {
public function getDirectoryContent($directory): \Traversable {
return $this->getWrapperStorage()->getDirectoryContent($directory);
}

Expand Down
Loading