Skip to content

Commit

Permalink
Internal refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Jun 5, 2024
1 parent ab93da8 commit 385b6ff
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Version/Persister/TagPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ public function getCurrentVersion(Context $context): string
// Extract versions from tags and sort them
$versions = $this->getVersionFromTags($tags, $context);

if ([] === $versions) {
throw new NoReleaseFoundException('No versions found in tag list');
}

usort($versions, [$context->versionGenerator, 'compareVersions']);

if ($this->versionedBranch) {
$branchVersions = $this->getPrefixedVersions($context, $versions);

Expand Down Expand Up @@ -102,10 +96,17 @@ private function getVersionFromTag(string $tagName, Context $context): string
private function getVersionFromTags(array $tags, Context $context): array
{
$versions = [];

foreach ($tags as $tag) {
$versions[] = $this->getVersionFromTag($tag, $context);
}

if ([] === $versions) {
throw new NoReleaseFoundException('No versions found in tag list');
}

usort($versions, [$context->versionGenerator, 'compareVersions']);

return $versions;
}

Expand Down

0 comments on commit 385b6ff

Please sign in to comment.