]> khamidou — GitHub mirrors - arcanist.git/commit
Detect use of f()[0] in lint
authorepriestley <git@epriestley.com>
Wed, 15 Aug 2012 11:36:50 +0000 (04:36 -0700)
committerepriestley <git@epriestley.com>
Wed, 15 Aug 2012 11:36:50 +0000 (04:36 -0700)
commita0d4430271f2660f2cbb674897894185e0f85a91
treefc1c6d01caf5d61355b93063d5f7ea774735bf3a
parentab602e3a524a8366688b1bcf118b8e98cf63c153
Detect use of f()[0] in lint

Summary: XHPAST doesn't currently parse most PHP 5.4 stuff, but it does parse this. Warn about it.

Test Plan:
Unit tests, and:

   Error  (XHP35) Use Of PHP 5.4 Features
    The f()[...] syntax was not introduced until PHP 5.4, but this codebase
    targets an earlier version of PHP. You can rewrite this expression using
    idx().

             365   public function lintPHP54Features($root) {
             366
             367     if (false) {
    >>>      368       id()[0];
                            ^
             369     }
             370

Reviewers: alanh, vrana

Reviewed By: alanh

CC: aran
Differential Revision: https://secure.phabricator.com/D3291
src/lint/engine/PhutilLintEngine.php
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/index-function.lint-test [new file with mode: 0644]