Differential D13895 Diff 33641 src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php
| Show All 23 Lines | $all_paren_groups = $root->selectDescendantsOfTypes(array( | ||||
| 'n_FOREACH_EXPRESSION', | 'n_FOREACH_EXPRESSION', | ||||
| )); | )); | ||||
| foreach ($all_paren_groups as $group) { | foreach ($all_paren_groups as $group) { | ||||
| $tokens = $group->getTokens(); | $tokens = $group->getTokens(); | ||||
| $token_o = array_shift($tokens); | $token_o = array_shift($tokens); | ||||
| $token_c = array_pop($tokens); | $token_c = array_pop($tokens); | ||||
| if ($token_o->getTypeName() !== '(') { | |||||
| throw new Exception(pht('Expected open parentheses.')); | |||||
| } | |||||
| if ($token_c->getTypeName() !== ')') { | |||||
| throw new Exception(pht('Expected close parentheses.')); | |||||
| } | |||||
| $nonsem_o = $token_o->getNonsemanticTokensAfter(); | $nonsem_o = $token_o->getNonsemanticTokensAfter(); | ||||
| $nonsem_c = $token_c->getNonsemanticTokensBefore(); | $nonsem_c = $token_c->getNonsemanticTokensBefore(); | ||||
| if (!$nonsem_o) { | if (!$nonsem_o) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| Show All 26 Lines | |||||