Skip to content

Commit 5fb743f

Browse files
committed
Merge branch 'master' into 3.0
2 parents e8acf8e + 2195cf4 commit 5fb743f

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public function process(File $phpcsFile, $stackPtr)
9797

9898
if ($tokens[$nextSeparator]['code'] === T_COMMA) {
9999
if ($tokens[($nextSeparator - 1)]['code'] === T_WHITESPACE) {
100-
if (isset(Tokens::$heredocTokens[$tokens[($nextSeparator - 2)]['code']]) === false) {
100+
$prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($nextSeparator - 2), null, true);
101+
if (isset(Tokens::$heredocTokens[$tokens[$prev]['code']]) === false) {
101102
$error = 'Space found before comma in function call';
102103
$fix = $phpcsFile->addFixableError($error, $nextSeparator, 'SpaceBeforeComma');
103104
if ($fix === true) {

src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc

+8
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,11 @@ $b = foo(
9393
"3",// this is a comment
9494
"4"
9595
);
96+
97+
var_dump(
98+
<<<TEXT
99+
foo
100+
TEXT
101+
,
102+
'bar'
103+
);

src/Standards/Generic/Tests/Functions/FunctionCallArgumentSpacingUnitTest.inc.fixed

+8
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,11 @@ $b = foo(
9393
"3", // this is a comment
9494
"4"
9595
);
96+
97+
var_dump(
98+
<<<TEXT
99+
foo
100+
TEXT
101+
,
102+
'bar'
103+
);

0 commit comments

Comments
 (0)