diff --git a/src/lint/linter/ArcanistBaseXHPASTLinter.php b/src/lint/linter/ArcanistBaseXHPASTLinter.php index 86b0072e..7951c62e 100644 --- a/src/lint/linter/ArcanistBaseXHPASTLinter.php +++ b/src/lint/linter/ArcanistBaseXHPASTLinter.php @@ -9,6 +9,19 @@ abstract class ArcanistBaseXHPASTLinter extends ArcanistFutureLinter { private $trees = array(); private $exceptions = array(); + final public function getCacheVersion() { + $parts = array(); + + $parts[] = $this->getVersion(); + + $path = xhpast_get_binary_path(); + if (Filesystem::pathExists($path)) { + $parts[] = md5_file($path); + } + + return implode('-', $parts); + } + final protected function raiseLintAtToken( XHPASTToken $token, $code, diff --git a/src/lint/linter/ArcanistPhutilXHPASTLinter.php b/src/lint/linter/ArcanistPhutilXHPASTLinter.php index c14ec7e8..fac28937 100644 --- a/src/lint/linter/ArcanistPhutilXHPASTLinter.php +++ b/src/lint/linter/ArcanistPhutilXHPASTLinter.php @@ -60,13 +60,9 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter { return 'phutil-xhpast'; } - public function getCacheVersion() { - $version = '2'; - $path = xhpast_get_binary_path(); - if (Filesystem::pathExists($path)) { - $version .= '-'.md5_file($path); - } - return $version; + public function getVersion() { + // The version number should be incremented whenever a new rule is added. + return '2'; } public function getLinterConfigurationOptions() { diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 8ac3bb12..ff3da80f 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -186,13 +186,9 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { return parent::setLinterConfigurationValue($key, $value); } - public function getCacheVersion() { - $version = '5'; - $path = xhpast_get_binary_path(); - if (Filesystem::pathExists($path)) { - $version .= '-'.md5_file($path); - } - return $version; + public function getVersion() { + // The version number should be incremented whenever a new rule is added. + return '5'; } protected function resolveFuture($path, Future $future) {