mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 05:50:54 +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() {
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue