mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-11-25 21:31:58 +00:00
Keep a two digit minor in parseVersion (#1134)
Co-authored-by: Michael Lip <51033404+theluckystrike@users.noreply.github.com>
This commit is contained in:
+3
-6
@@ -91,12 +91,9 @@ export async function parseVersion(version: string): Promise<string> {
|
||||
if (!/^\d+(\.\d+){0,2}$/.test(version)) {
|
||||
throw new Error(`Invalid PHP version: ${version.slice(0, 20)}`);
|
||||
}
|
||||
switch (true) {
|
||||
case version.length > 1:
|
||||
return version.slice(0, 3);
|
||||
default:
|
||||
return version + '.0';
|
||||
}
|
||||
return version.includes('.')
|
||||
? version.split('.').slice(0, 2).join('.')
|
||||
: version + '.0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user