mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 14:00:55 +01:00
Warn against usage of nowdoc
Summary: Also include binary hash in the version. Test Plan: New unit test. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4535
This commit is contained in:
parent
85c0ed13d9
commit
78017033bd
2 changed files with 21 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
6
src/lint/linter/__tests__/xhpast/nowdoc.lint-test
Normal file
6
src/lint/linter/__tests__/xhpast/nowdoc.lint-test
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
echo <<<'EOT'
|
||||
Hello World!
|
||||
EOT;
|
||||
~~~~~~~~~~
|
||||
disabled:2:6
|
Loading…
Reference in a new issue