1
0
Fork 0

Merge pull request #8718 from localheinz/fix/early

Fix: Return early
pull/8740/head
Jordi Boggiano 2020-03-29 16:59:26 +02:00 committed by GitHub
commit a8c105da34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 20 deletions

View File

@ -63,27 +63,31 @@ class VersionGuesser
*/ */
public function guessVersion(array $packageConfig, $path) public function guessVersion(array $packageConfig, $path)
{ {
if (function_exists('proc_open')) { if (!function_exists('proc_open')) {
$versionData = $this->guessGitVersion($packageConfig, $path); return null;
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessHgVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessFossilVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessSvnVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
} }
$versionData = $this->guessGitVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessHgVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessFossilVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
$versionData = $this->guessSvnVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
return null;
} }
private function postprocess(array $versionData) private function postprocess(array $versionData)