diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 6d211a72..9a490997 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -249,6 +249,19 @@ final class ArcanistXHPASTLinter extends ArcanistLinter { 'This codebase targets PHP 5.2, but namespaces were not introduced '. 'until PHP 5.3.'); } + + $statics = $root->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); + foreach ($statics as $static) { + $name = $static->getChildOfType(0, 'n_CLASS_NAME'); + if ($name->getConcreteString() == 'static') { + $this->raiseLintAtNode( + $name, + self::LINT_PHP_53_FEATURES, + 'This codebase targets PHP 5.2, but `static::` was not introduced '. + 'until PHP 5.3.'); + } + } + } private function lintImplicitFallthrough($root) { diff --git a/src/lint/linter/__tests__/xhpast/php53.lint-test b/src/lint/linter/__tests__/xhpast/php53.lint-test index 8622b9ac..cfe8254a 100644 --- a/src/lint/linter/__tests__/xhpast/php53.lint-test +++ b/src/lint/linter/__tests__/xhpast/php53.lint-test @@ -5,9 +5,11 @@ use b, c; f(function() {}); g(function() use ($c) {}); h(function /* ! */ () use ($c) {}); +static::m(); ~~~~~~~~~~ disabled:3:1 disabled:4:5 disabled:5:3 disabled:6:3 disabled:7:3 +disabled:8:1 \ No newline at end of file