Skip to content

Commit

Permalink
fix processing for If the version has a stability string
Browse files Browse the repository at this point in the history
Fixed an issue that would result in `5.9.0-beta1-beta` if version was defined for `5.9.0-beta1`
  • Loading branch information
hrs-o committed Dec 7, 2020
1 parent 0ddd3e2 commit fc5d1a9
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/Package/Util/Dumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ public function dump(Interfaces\Package $package, $with_version = true)
$data['name'] = $package->getPrettyName();

if ($with_version) {
$data['version'] = $package->getPrettyVersion();
$version_stability = VersionParser::parseStability($data['version']);
$stability = $package->getStability();

if ('stable' !== $stability && 'RC' !== $version_stability) {
$data['version'] .= '-' . $stability;
}
$data['version'] = $this->getVersion($package);
}

$data['type'] = $package->getType();
Expand All @@ -86,6 +80,23 @@ public function dump(Interfaces\Package $package, $with_version = true)

return $data;
}

/**
* @param Interfaces\Package $package
*
* @return string
*/
private function getVersion(Interfaces\Package $package): string
{
$version = $package->getPrettyVersion();
$version_stability = VersionParser::parseStability($version);
$stability = $package->getStability();

if ('beta' === $stability && 'stable' === $version_stability) {
return $version . '-' . $stability;
}
return $version;
}
}

/* vim: set tabstop=4 shiftwidth=4 expandtab: fdm=marker */

0 comments on commit fc5d1a9

Please sign in to comment.