Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13978428
D11350.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11350.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11350: Improve lint handling of `declare()` special statement blocks
Attached
Detach File
Event Timeline
Log In to Comment