1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Simplify version parsing for ArcanistPhpLinter

Summary: We can use `php --run "echo phpversion();"` to return a nice, compact representation of the PHP version.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11264
This commit is contained in:
Joshua Spence 2015-01-07 23:55:34 +11:00
parent ff3d3792ba
commit 2ad2c04774

View file

@ -39,15 +39,11 @@ final class ArcanistPhpLinter extends ArcanistExternalLinter {
}
public function getVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
$regex = '/^PHP (?P<version>\d+\.\d+\.\d+)\b/';
if (preg_match($regex, $stdout, $matches)) {
return $matches['version'];
} else {
return false;
}
list($stdout) = execx(
'%C --run %s',
$this->getExecutableCommand(),
'echo phpversion();');
return $stdout;
}
public function shouldExpectCommandErrors() {