]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Handle $var::method() in XHPAST linter
authorvrana <jakubv@fb.com>
Fri, 1 Feb 2013 19:17:46 +0000 (11:17 -0800)
committervrana <jakubv@fb.com>
Fri, 1 Feb 2013 19:21:06 +0000 (11:21 -0800)
Test Plan: Didn't see a fatal in new test case.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4783

src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/php53.lint-test

index 05ed652ce39978943500955aa1a3d76478414c70..f078f2136506a59eeb031857655b775fb9068462 100644 (file)
@@ -340,7 +340,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
 
     $statics = $root->selectDescendantsOfType('n_CLASS_STATIC_ACCESS');
     foreach ($statics as $static) {
-      $name = $static->getChildOfType(0, 'n_CLASS_NAME');
+      $name = $static->getChildByIndex(0);
+      if ($name->getTypeName() != 'n_CLASS_NAME') {
+        continue;
+      }
       if ($name->getConcreteString() == 'static') {
         $this->raiseLintAtNode(
           $name,
index 166e06e798fdea45ac4826b9d5cfad6d22a3ed2d..722705283abc354b21b5d6bc91395c284b4cbeb9 100644 (file)
@@ -8,6 +8,8 @@ h(function /* ! */ () use ($c) {});
 static::m();
 1 ? 1 : 2;
 1 ?: 2;
+$a = 'stdClass';
+$a::m();
 ~~~~~~~~~~
 disabled:3:1
 disabled:4:5
@@ -15,4 +17,4 @@ disabled:5:3
 disabled:6:3
 disabled:7:3
 disabled:8:1
-disabled:10:1
\ No newline at end of file
+disabled:10:1