mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +01:00
Memoize PHP compatibility info
Summary: Ref T7892. Avoid reading the PHP compatibility information for every file being linted. Test Plan: ```name=Before real 1m24.327s user 1m19.571s sys 0m5.239s ``` ```lang=After real 1m12.029s user 1m5.756s sys 0m5.502s ``` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7892 Differential Revision: https://secure.phabricator.com/D12518
This commit is contained in:
parent
f4aadb9604
commit
d6f4bded25
1 changed files with 7 additions and 3 deletions
|
@ -500,13 +500,17 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function lintPHPCompatibility(XHPASTNode $root) {
|
private function lintPHPCompatibility(XHPASTNode $root) {
|
||||||
|
static $compat_info;
|
||||||
|
|
||||||
if (!$this->version) {
|
if (!$this->version) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = phutil_get_library_root('phutil').
|
if ($compat_info === null) {
|
||||||
'/../resources/php_compat_info.json';
|
$target = phutil_get_library_root('phutil').
|
||||||
$compat_info = phutil_json_decode(Filesystem::readFile($target));
|
'/../resources/php_compat_info.json';
|
||||||
|
$compat_info = phutil_json_decode(Filesystem::readFile($target));
|
||||||
|
}
|
||||||
|
|
||||||
// Create a whitelist for symbols which are being used conditionally.
|
// Create a whitelist for symbols which are being used conditionally.
|
||||||
$whitelist = array(
|
$whitelist = array(
|
||||||
|
|
Loading…
Reference in a new issue