1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 08:12:40 +01:00

Fix LINT_ARRAY_SEPARATOR for heredocs

Summary: It is not correct to add a trailing comma if the `n_ARRAY_VALUE` node is a heredoc string.

Test Plan: Added a test case.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10569
This commit is contained in:
Joshua Spence 2014-09-26 08:35:40 +10:00
parent cb20078250
commit 247a4fabb8
2 changed files with 14 additions and 0 deletions

View file

@ -2736,6 +2736,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$after = last($value->getTokens())->getNextToken();
if ($multiline && (!$after || $after->getValue() != ',')) {
if ($value->getChildByIndex(1)->getTypeName() == 'n_HEREDOC') {
continue;
}
$this->raiseLintAtNode(
$value,
self::LINT_ARRAY_SEPARATOR,

View file

@ -15,6 +15,11 @@ array(
'foo',
array('foo')
);
array(
'foo' => <<<EOTEXT
This is some heredoc text.
EOTEXT
);
~~~~~~~~~~
advice:3:14
advice:12:3
@ -37,3 +42,8 @@ array(
'foo',
array('foo'),
);
array(
'foo' => <<<EOTEXT
This is some heredoc text.
EOTEXT
);