1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Allow spaces after the . operator if followed by a comment.

Summary: Currently, `'foo'.    // Some comment` is not allowed by the `ArcanistXHPASTLinter::LINT_BINARY_EXPRESSION_SPACING` rule. I believe that in the case of a trailing comment, we //should// allow whitespace after the `.` operator.

Test Plan: Wrote and executed a unit test for this case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9438
This commit is contained in:
Joshua Spence 2014-06-09 12:25:14 -07:00 committed by epriestley
parent 833ce45155
commit 57f4bbae42
2 changed files with 12 additions and 3 deletions

View file

@ -1975,6 +1975,11 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
continue; continue;
} }
$next = $wtoken->getNextToken();
if ($next && $next->getTypeName() == 'T_COMMENT') {
continue;
}
$this->raiseLintAtToken( $this->raiseLintAtToken(
$wtoken, $wtoken,
self::LINT_BINARY_EXPRESSION_SPACING, self::LINT_BINARY_EXPRESSION_SPACING,

View file

@ -5,6 +5,8 @@ $a. $b;
$a .$b; $a .$b;
$a. $a.
$b; $b;
$a. // This should be okay.
$b;
array($x => $y); array($x => $y);
array($x=>$y); array($x=>$y);
@ -26,10 +28,10 @@ warning:3:3
warning:3:5 warning:3:5
warning:4:4 warning:4:4
warning:5:3 warning:5:3
warning:10:9
warning:11:10
warning:12:9 warning:12:9
warning:22:5 warning:13:10
warning:14:9
warning:24:5
~~~~~~~~~~ ~~~~~~~~~~
<?php <?php
$a.$b; $a.$b;
@ -38,6 +40,8 @@ $a.$b;
$a.$b; $a.$b;
$a. $a.
$b; $b;
$a. // This should be okay.
$b;
array($x => $y); array($x => $y);
array($x => $y); array($x => $y);