Skip to content

Commit

Permalink
Fix report errors
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Mar 31, 2024
1 parent 2050543 commit f3f6319
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/PreRelease.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function increment(): PreRelease
}

if (-1 != $lastNumericIndex) {
$result->preReleaseParts[$lastNumericIndex] = (string) (intval($result->preReleaseParts[$lastNumericIndex]) + 1);
$result->preReleaseParts[$lastNumericIndex] =
(string) (intval($result->preReleaseParts[$lastNumericIndex]) + 1);
} else {
$result->preReleaseParts[] = '0';
}
Expand Down
23 changes: 7 additions & 16 deletions src/Traits/NextProducer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,12 @@ public function getNextPreReleaseVersion(?string $preRelease = null): Version
*/
public function inc(int $by, ?string $preRelease = null): Version
{
switch ($by) {
case Inc::MAJOR:
return $this->getNextMajorVersion($preRelease);

case Inc::MINOR:
return $this->getNextMinorVersion($preRelease);

case Inc::PATCH:
return $this->getNextPatchVersion($preRelease);

case Inc::PRE_RELEASE:
return $this->getNextPreReleaseVersion($preRelease);

default:
throw new SemverException('Invalid `by` argument in inc() method');
}
return match ($by) {
Inc::MAJOR => $this->getNextMajorVersion($preRelease),
Inc::MINOR => $this->getNextMinorVersion($preRelease),
Inc::PATCH => $this->getNextPatchVersion($preRelease),
Inc::PRE_RELEASE => $this->getNextPreReleaseVersion($preRelease),
default => throw new SemverException('Invalid `by` argument in inc() method'),
};
}
}

0 comments on commit f3f6319

Please sign in to comment.