Skip to content

Commit

Permalink
Fix small issues from #16
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Jan 27, 2021
1 parent 652d14f commit 5e9b36e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Next.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

final class Next
{
private const PRE_RELEASE_CHUNK_COUNT = 2;

public static function run(string $versionString, bool $strict): string
{
try {
Expand All @@ -31,11 +33,9 @@ public static function run(string $versionString, bool $strict): string
}

// split versionString by '-' (in case it is a pre-release)
if (strpos($versionString, '-') >= 1) {
$pieces = explode('-', $versionString, 2);
$versionString = $pieces[0];
$preRelease = $pieces[1];
$versionString .= '.0-' . $preRelease;
if (strpos($versionString, '-') !== false) {
[$versionString, $preRelease] = explode('-', $versionString, self::PRE_RELEASE_CHUNK_COUNT);
$versionString .= '.0-' . $preRelease;
} else {
$versionString .= '.0';
}
Expand Down

0 comments on commit 5e9b36e

Please sign in to comment.