Skip to content

Commit

Permalink
Fix return type of Version::ensure and ContentStorageHandler::ensure
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Jun 17, 2024
1 parent b2c2e88 commit 07885e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/Content/ContentStorageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ public function dynamicVersions(): array
*
* @throws \Kirby\Exception\NotFoundException If the version does not exist
*/
public function ensure(VersionId $versionId, Language $language): bool
public function ensure(VersionId $versionId, Language $language): void
{
if ($this->exists($versionId, $language) !== true) {
$message = match($this->model->kirby()->multilang()) {
true => 'Version "' . $versionId . ' (' . $language->code() . ')" does not already exist',
false => 'Version "' . $versionId . '" does not already exist',
};

throw new NotFoundException($message);
if ($this->exists($versionId, $language) === true) {
return;
}

return true;
$message = match($this->model->kirby()->multilang()) {
true => 'Version "' . $versionId . ' (' . $language->code() . ')" does not already exist',
false => 'Version "' . $versionId . '" does not already exist',
};

throw new NotFoundException($message);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Content/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function delete(): void
*/
public function ensure(
Language|string $language = 'default'
): bool {
return $this->model->storage()->ensure($this->id, $this->language($language));
): void {
$this->model->storage()->ensure($this->id, $this->language($language));
}

/**
Expand Down

0 comments on commit 07885e3

Please sign in to comment.