From e3e232530c6e9393228cdd246ba9f4a48c0f5917 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Wed, 18 Nov 2015 07:20:39 +1100 Subject: [PATCH] Fix brace formatting linter rule after XHPAST changes 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 --- .../ArcanistBraceFormattingXHPASTLinterRule.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php index d2908154..0a8c33b7 100644 --- a/src/lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/rules/ArcanistBraceFormattingXHPASTLinterRule.php @@ -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; } } -- 2.43.0