]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Add lint warning for $o->m()[0], not just f()[0]
authorepriestley <git@epriestley.com>
Tue, 12 Feb 2013 15:07:35 +0000 (07:07 -0800)
committerepriestley <git@epriestley.com>
Tue, 12 Feb 2013 15:07:35 +0000 (07:07 -0800)
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
src/lint/linter/__tests__/xhpast/php54.lint-test [new file with mode: 0644]

index 1895ccd2adffadaf4de5457f4c2e55a87550ba4f..52b55c74e7193ae46439691d41e0d9a857fcf38e 100644 (file)
@@ -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 (file)
index 0000000..8bc7d66
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+f()[0];
+$o->m()[0];
+
+~~~~~~~~~~
+disabled:3:5
+disabled:4:9