From 8374dbc4e3bda403a1c9ad9303d901546c3a44c9 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 1 Feb 2013 11:17:46 -0800 Subject: [PATCH] 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 --- src/lint/linter/ArcanistXHPASTLinter.php | 5 ++++- src/lint/linter/__tests__/xhpast/php53.lint-test | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) 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 -- 2.43.0