]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Ensure that a space is used after a catch token
authorJoshua Spence <josh@joshuaspence.com>
Wed, 24 Jun 2015 21:09:17 +0000 (07:09 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Wed, 24 Jun 2015 21:09:17 +0000 (07:09 +1000)
Summary: For consistency, a single space should separate `catch` and the following parenthetical expression.

Test Plan: Added test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

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

src/lint/linter/__tests__/xhpast/space-after-control-keywords.lint-test
src/lint/linter/xhpast/rules/ArcanistControlStatementSpacingXHPASTLinterRule.php

index 444a052f0cb0c6c509a0b04a531b0468a35679c9..57cb4aaae94de2540b7d9abecb16bc81f034da94 100644 (file)
@@ -22,6 +22,8 @@ if ($x) {
 do {
   echo 1;
 } while(true);
+
+try {} catch(Exception $ex) {}
 ~~~~~~~~~~
 warning:2:1
 warning:2:10
@@ -37,6 +39,7 @@ warning:10:16
 warning:13:3
 warning:14:3
 warning:24:3
+warning:26:8
 ~~~~~~~~~~
 <?php
 if ($x) {} else {}
@@ -57,3 +60,5 @@ if ($x) {
 do {
   echo 1;
 } while (true);
+
+try {} catch (Exception $ex) {}
index fe058670d24b531fc509a5012e0e1267c1c89492..cf925cc0b4918a90f9d61c425163a074aed76016 100644 (file)
@@ -23,6 +23,7 @@ final class ArcanistControlStatementSpacingXHPASTLinterRule
         case 'T_WHILE':
         case 'T_DO':
         case 'T_SWITCH':
+        case 'T_CATCH':
           $after = $token->getNonsemanticTokensAfter();
           if (empty($after)) {
             $this->raiseLintAtToken(