Skip to content

Commit e3bf91f

Browse files
authored
Add option to allow heredoc after function open bracket
1 parent ca606d9 commit e3bf91f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ 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 bool
61+
*/
62+
public $allowHereDocAfterOpenBracket = false;
5763

5864
/**
5965
* Returns an array of tokens this test wants to listen for.
@@ -402,7 +408,11 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
402408
}
403409
}//end if
404410

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

0 commit comments

Comments
 (0)