Page MenuHomePhabricator

D14615.diff
No OneTemporary

D14615.diff

diff --git a/src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistParenthesesSpacingXHPASTLinterRule.php
@@ -18,10 +18,11 @@
'n_ARRAY_VALUE_LIST',
'n_ASSIGNMENT_LIST',
'n_CALL_PARAMETER_LIST',
- 'n_DECLARATION_PARAMETER_LIST',
'n_CONTROL_CONDITION',
+ 'n_DECLARATION_PARAMETER_LIST',
'n_FOR_EXPRESSION',
'n_FOREACH_EXPRESSION',
+ 'n_LEXICAL_VARIABLE_LIST',
));
foreach ($all_paren_groups as $group) {
diff --git a/src/lint/linter/xhpast/rules/ArcanistVariableReferenceSpacingXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistVariableReferenceSpacingXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistVariableReferenceSpacingXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistVariableReferenceSpacingXHPASTLinterRule.php
@@ -24,7 +24,9 @@
if ($before) {
$this->raiseLintAtOffset(
head($before)->getOffset(),
- pht('Variable references should not be prefixed with whitespace.'),
+ pht(
+ 'For consistency, variable references should not be '.
+ 'prefixed with whitespace.'),
implode('', mpull($before, 'getValue')),
'');
}
diff --git a/src/lint/linter/xhpast/rules/__tests__/parentheses-spacing/closure.lint-test b/src/lint/linter/xhpast/rules/__tests__/parentheses-spacing/closure.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/xhpast/rules/__tests__/parentheses-spacing/closure.lint-test
@@ -0,0 +1,12 @@
+<?php
+
+$x = function ( $y) use ( $z) {
+ return $y + $z;
+};
+~~~~~~~~~~
+warning:3:16
+warning:3:26
+~~~~~~~~~~
+$x = function ($y ) use ($z ) {
+ return $y + $z;
+};

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 24, 3:48 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6745765
Default Alt Text
D14615.diff (1 KB)

Event Timeline