diff --git a/src/lint/linter/xhpast/rules/ArcanistCurlyBraceArrayIndexXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistCurlyBraceArrayIndexXHPASTLinterRule.php index 2d2fa171..99b3ab94 100644 --- a/src/lint/linter/xhpast/rules/ArcanistCurlyBraceArrayIndexXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/rules/ArcanistCurlyBraceArrayIndexXHPASTLinterRule.php @@ -19,6 +19,10 @@ final class ArcanistCurlyBraceArrayIndexXHPASTLinterRule foreach ($index_accesses as $index_access) { $tokens = $index_access->getChildByIndex(1)->getTokens(); + if (!$tokens) { + continue; + } + $left_brace = head($tokens)->getPrevToken(); while (!$left_brace->isSemantic()) { $left_brace = $left_brace->getPrevToken(); diff --git a/src/lint/linter/xhpast/rules/__tests__/curly-brace-array-index/array_push.lint-test b/src/lint/linter/xhpast/rules/__tests__/curly-brace-array-index/array_push.lint-test new file mode 100644 index 00000000..266b2844 --- /dev/null +++ b/src/lint/linter/xhpast/rules/__tests__/curly-brace-array-index/array_push.lint-test @@ -0,0 +1,3 @@ +