mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +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:
parent
ff3d3792ba
commit
2ad2c04774
1 changed files with 5 additions and 9 deletions
|
@ -39,15 +39,11 @@ final class ArcanistPhpLinter extends ArcanistExternalLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVersion() {
|
public function getVersion() {
|
||||||
list($stdout) = execx('%C --version', $this->getExecutableCommand());
|
list($stdout) = execx(
|
||||||
|
'%C --run %s',
|
||||||
$matches = array();
|
$this->getExecutableCommand(),
|
||||||
$regex = '/^PHP (?P<version>\d+\.\d+\.\d+)\b/';
|
'echo phpversion();');
|
||||||
if (preg_match($regex, $stdout, $matches)) {
|
return $stdout;
|
||||||
return $matches['version'];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldExpectCommandErrors() {
|
public function shouldExpectCommandErrors() {
|
||||||
|
|
Loading…
Reference in a new issue