diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index a65fdbe7..b845f55e 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -155,6 +155,10 @@ final class ArcanistXHPASTLinter extends ArcanistLinter { return idx($this->trees, $path); } + public function getCacheVersion() { + return '1-'.md5_file(xhpast_get_binary_path()); + } + public function lintPath($path) { if (empty($this->trees[$path])) { return; @@ -393,6 +397,17 @@ final class ArcanistXHPASTLinter extends ArcanistLinter { } } + $heredocs = $root->selectDescendantsOfType('n_HEREDOC'); + foreach ($heredocs as $heredoc) { + if (preg_match('/^<<<[\'"]/', $heredoc->getConcreteString())) { + $this->raiseLintAtNode( + $heredoc, + self::LINT_PHP_53_FEATURES, + 'This codebase targets PHP 5.2, but nowdoc was not introduced until '. + 'PHP 5.3.'); + } + } + $this->lintPHP53Functions($root); } diff --git a/src/lint/linter/__tests__/xhpast/nowdoc.lint-test b/src/lint/linter/__tests__/xhpast/nowdoc.lint-test new file mode 100644 index 00000000..de8f8878 --- /dev/null +++ b/src/lint/linter/__tests__/xhpast/nowdoc.lint-test @@ -0,0 +1,6 @@ +