Page MenuHomePhabricator

D11350.diff
No OneTemporary

D11350.diff

diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php
--- a/src/lint/linter/ArcanistXHPASTLinter.php
+++ b/src/lint/linter/ArcanistXHPASTLinter.php
@@ -974,7 +974,12 @@
foreach ($nodes as $node) {
$parent = $node->getParentNode();
- if ($parent && $parent->getTypeName() != 'n_STATEMENT_LIST') {
+ if (!$parent) {
+ continue;
+ }
+
+ $type = $parent->getTypeName();
+ if ($type != 'n_STATEMENT_LIST' && $type != 'n_DECLARE') {
$this->raiseLintAtNode(
$node,
self::LINT_BRACE_FORMATTING,
diff --git a/src/lint/linter/__tests__/xhpast/creative-brace-use.lint-test b/src/lint/linter/__tests__/xhpast/creative-brace-use.lint-test
--- a/src/lint/linter/__tests__/xhpast/creative-brace-use.lint-test
+++ b/src/lint/linter/__tests__/xhpast/creative-brace-use.lint-test
@@ -34,6 +34,8 @@
if ($x) {}
else if ($y) {}
else {}
+
+declare(ticks = 1);
~~~~~~~~~~
advice:3:14
warning:7:13
@@ -74,3 +76,5 @@
do baz(); while ($x);
if ($x) {} else if ($y) {} else {}
+
+declare(ticks = 1);

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 11:08 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734235
Default Alt Text
D11350.diff (1 KB)

Event Timeline