From 42ae7cd92f92e026bdd604e659d2bc23e9352baa Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 12 Feb 2013 07:07:35 -0800 Subject: [PATCH] Add lint warning for $o->m()[0], not just f()[0] Summary: We only caught half of this. Test Plan: Unit test. Reviewers: edward Reviewed By: edward CC: aran Maniphest Tasks: T1261 Differential Revision: https://secure.phabricator.com/D4920 --- src/lint/linter/ArcanistXHPASTLinter.php | 1 + src/lint/linter/__tests__/xhpast/php54.lint-test | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 src/lint/linter/__tests__/xhpast/php54.lint-test diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php index 1895ccd2..52b55c74 100644 --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -440,6 +440,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter { $left = $index->getChildByIndex(0); switch ($left->getTypeName()) { case 'n_FUNCTION_CALL': + case 'n_METHOD_CALL': $this->raiseLintAtNode( $index->getChildByIndex(1), self::LINT_PHP_54_FEATURES, diff --git a/src/lint/linter/__tests__/xhpast/php54.lint-test b/src/lint/linter/__tests__/xhpast/php54.lint-test new file mode 100644 index 00000000..8bc7d664 --- /dev/null +++ b/src/lint/linter/__tests__/xhpast/php54.lint-test @@ -0,0 +1,8 @@ +m()[0]; + +~~~~~~~~~~ +disabled:3:5 +disabled:4:9