From: vrana Date: Fri, 1 Feb 2013 19:17:46 +0000 (-0800) Subject: Handle $var::method() in XHPAST linter X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=8374dbc4e3bda403a1c9ad9303d901546c3a44c9;p=arcanist.git Handle $var::method() in XHPAST linter 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 --- diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 05ed652c..f078f213 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -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, diff --git a/src/lint/linter/__tests__/xhpast/php53.lint-test b/src/lint/linter/__tests__/xhpast/php53.lint-test index 166e06e7..72270528 100644 --- a/src/lint/linter/__tests__/xhpast/php53.lint-test +++ b/src/lint/linter/__tests__/xhpast/php53.lint-test @@ -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