]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix brace formatting linter rule after XHPAST changes
authorJoshua Spence <josh@freelancer.com>
Tue, 17 Nov 2015 20:20:39 +0000 (07:20 +1100)
committerJoshua Spence <josh@freelancer.com>
Tue, 17 Nov 2015 20:20:40 +0000 (07:20 +1100)
Summary: Adjusts `ArcanistBraceFormattingXHPASTLinterRule` after changes to the way in which XHPAST parses namespaces. Depends on D14498.

Test Plan: Unit tests are now passing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14499

src/lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php

index d29081541617f297d27cfa8e41af51c0ed71f32b..0a8c33b754117363fc3b22405beb4e32d54990f6 100644 (file)
@@ -61,10 +61,17 @@ final class ArcanistBraceFormattingXHPASTLinterRule
       }
 
       $type = $parent->getTypeName();
-      if ($type != 'n_STATEMENT_LIST' && $type != 'n_DECLARE') {
-        $this->raiseLintAtNode(
-          $node,
-          pht('Use braces to surround a statement block.'));
+      switch ($type) {
+        case 'n_DECLARE':
+        case 'n_NAMESPACE':
+        case 'n_STATEMENT_LIST':
+          break;
+
+        default:
+          $this->raiseLintAtNode(
+            $node,
+            pht('Use braces to surround a statement block.'));
+          break;
       }
     }