1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 00:49:11 +02:00

Add test for "static::" to the PHP 5.3 linter

Summary: See https://github.com/facebook/phabricator/issues/133.

Test Plan: Unit tests.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1158

Differential Revision: https://secure.phabricator.com/D2778
This commit is contained in:
epriestley 2012-06-17 09:01:47 -07:00
parent f2220e74fc
commit 7c3c1e88bd
2 changed files with 15 additions and 0 deletions

View file

@ -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) {

View file

@ -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