diff --git a/app/Mage.php b/app/Mage.php index 65419780fd1..e4ff5ebe541 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -176,25 +176,23 @@ public static function getVersionInfo() * Gets the current OpenMage version string * @link https://openmage.github.io/supported-versions.html * @link https://semver.org/ - * - * @return string */ public static function getOpenMageVersion(): string { $info = self::getOpenMageVersionInfo(); $versionString = "{$info['major']}.{$info['minor']}.{$info['patch']}"; - if ($info['stability'] || $info['number']) { - $versionString .= '-'; - if ($info['stability'] && $info['number']) { - $versionString .= implode('.', [$info['stability'], $info['number']]); - } else { - $versionString .= implode('', [$info['stability'], $info['number']]); - } + + if ($info['stability'] && $info['number']) { + return "{$versionString}-{$info['stability']}.{$info['number']}"; + } + if ($info['stability']) { + return "{$versionString}-{$info['stability']}"; } - return trim( - $versionString, - '.-' - ); + if ($info['number']) { + return "{$versionString}-{$info['number']}"; + } + + return $versionString; } /**