Skip to content

Commit c09bbe9

Browse files
committed
Add option to allow heredoc after function open bracket
1 parent ca606d9 commit c09bbe9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ class FunctionCallSignatureSniff implements Sniff
5454
*/
5555
public $requiredSpacesBeforeClose = 0;
5656

57+
/**
58+
* Allows Heredoc and Nowdoc to start after the opening bracket.
59+
*
60+
* @var boolean
61+
*/
62+
public $allowHereDocAfterOpenBracket = false;
63+
5764

5865
/**
5966
* Returns an array of tokens this test wants to listen for.
@@ -402,7 +409,15 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
402409
}
403410
}//end if
404411

405-
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($openBracket + 1), null, true);
412+
$nextTokens = Tokens::$emptyTokens;
413+
if ($this->allowHereDocAfterOpenBracket === true) {
414+
$nextTokens += [
415+
T_START_HEREDOC,
416+
T_START_NOWDOC,
417+
];
418+
}
419+
420+
$next = $phpcsFile->findNext($nextTokens, ($openBracket + 1), null, true);
406421
if ($tokens[$next]['line'] === $tokens[$openBracket]['line']) {
407422
$error = 'Opening parenthesis of a multi-line function call must be the last content on the line';
408423
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'ContentAfterOpenBracket');

0 commit comments

Comments
 (0)