mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01: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:
parent
f2220e74fc
commit
7c3c1e88bd
2 changed files with 15 additions and 0 deletions
|
@ -249,6 +249,19 @@ final class ArcanistXHPASTLinter extends ArcanistLinter {
|
||||||
'This codebase targets PHP 5.2, but namespaces were not introduced '.
|
'This codebase targets PHP 5.2, but namespaces were not introduced '.
|
||||||
'until PHP 5.3.');
|
'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) {
|
private function lintImplicitFallthrough($root) {
|
||||||
|
|
|
@ -5,9 +5,11 @@ use b, c;
|
||||||
f(function() {});
|
f(function() {});
|
||||||
g(function() use ($c) {});
|
g(function() use ($c) {});
|
||||||
h(function /* ! */ () use ($c) {});
|
h(function /* ! */ () use ($c) {});
|
||||||
|
static::m();
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:3:1
|
disabled:3:1
|
||||||
disabled:4:5
|
disabled:4:5
|
||||||
disabled:5:3
|
disabled:5:3
|
||||||
disabled:6:3
|
disabled:6:3
|
||||||
disabled:7:3
|
disabled:7:3
|
||||||
|
disabled:8:1
|
Loading…
Reference in a new issue