1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 17:48:50 +02:00
phorge-arcanist/src/lint/linter/__tests__/xhpast/index-function.lint-test
epriestley a0d4430271 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
2012-08-15 04:36:50 -07:00

4 lines
38 B
Text

<?php
f()[0];
~~~~~~~~~~
disabled:2:5