mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-18 01:38:38 +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:
parent
cb20078250
commit
247a4fabb8
2 changed files with 14 additions and 0 deletions
|
@ -2736,6 +2736,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
||||||
$after = last($value->getTokens())->getNextToken();
|
$after = last($value->getTokens())->getNextToken();
|
||||||
|
|
||||||
if ($multiline && (!$after || $after->getValue() != ',')) {
|
if ($multiline && (!$after || $after->getValue() != ',')) {
|
||||||
|
if ($value->getChildByIndex(1)->getTypeName() == 'n_HEREDOC') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->raiseLintAtNode(
|
$this->raiseLintAtNode(
|
||||||
$value,
|
$value,
|
||||||
self::LINT_ARRAY_SEPARATOR,
|
self::LINT_ARRAY_SEPARATOR,
|
||||||
|
|
|
@ -15,6 +15,11 @@ array(
|
||||||
'foo',
|
'foo',
|
||||||
array('foo')
|
array('foo')
|
||||||
);
|
);
|
||||||
|
array(
|
||||||
|
'foo' => <<<EOTEXT
|
||||||
|
This is some heredoc text.
|
||||||
|
EOTEXT
|
||||||
|
);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:3:14
|
advice:3:14
|
||||||
advice:12:3
|
advice:12:3
|
||||||
|
@ -37,3 +42,8 @@ array(
|
||||||
'foo',
|
'foo',
|
||||||
array('foo'),
|
array('foo'),
|
||||||
);
|
);
|
||||||
|
array(
|
||||||
|
'foo' => <<<EOTEXT
|
||||||
|
This is some heredoc text.
|
||||||
|
EOTEXT
|
||||||
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue