Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,12 @@ public function processMultiLineCall(File $phpcsFile, int $stackPtr, int $openBr
$expectedIndent = ($foundFunctionIndent + $this->indent + $adjustment);
}

if ($tokens[$i]['code'] === T_END_HEREDOC
|| $tokens[$i]['code'] === T_END_NOWDOC
) {
continue;
}

if ($tokens[$i]['code'] !== T_WHITESPACE
&& $tokens[$i]['code'] !== T_DOC_COMMENT_WHITESPACE
) {
Expand Down Expand Up @@ -551,7 +557,10 @@ public function processMultiLineCall(File $phpcsFile, int $stackPtr, int $openBr
$padding = str_repeat(' ', $expectedIndent);
if ($foundIndent === 0) {
$phpcsFile->fixer->addContentBefore($i, $padding);
if (isset($tokens[$i]['scope_opener']) === true) {
if (isset($tokens[$i]['scope_opener']) === true
&& $tokens[$i]['code'] !== T_START_HEREDOC
&& $tokens[$i]['code'] !== T_START_NOWDOC
) {
$phpcsFile->fixer->changeCodeBlockIndent($i, $tokens[$i]['scope_closer'], $expectedIndent);
}
} else {
Expand All @@ -562,7 +571,10 @@ public function processMultiLineCall(File $phpcsFile, int $stackPtr, int $openBr
$phpcsFile->fixer->replaceToken($i, $padding);
}

if (isset($tokens[($i + 1)]['scope_opener']) === true) {
if (isset($tokens[($i + 1)]['scope_opener']) === true
&& $tokens[($i + 1)]['code'] !== T_START_HEREDOC
&& $tokens[($i + 1)]['code'] !== T_START_NOWDOC
) {
$phpcsFile->fixer->changeCodeBlockIndent(($i + 1), $tokens[($i + 1)]['scope_closer'], ($expectedIndent - $foundIndent));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,3 +609,10 @@ $anon = new class () {};

// And anonymous object instantiations without parentheses are ignored.
$anon = new class {};

// Flexible heredoc in multiline function call.
<?php if (1) f(
<<<E
x
E
);
Original file line number Diff line number Diff line change
Expand Up @@ -628,3 +628,10 @@ $anon = new class () {};

// And anonymous object instantiations without parentheses are ignored.
$anon = new class {};

// Flexible heredoc in multiline function call.
<?php if (1) f(
<<<E
x
E
);
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function getErrorList()
603 => 1,
604 => 1,
605 => 2,
615 => 1,
];
}

Expand Down
Loading