function MultiLineFunctionDeclarationSniff::isMultiLineDeclaration
Same name in this branch
- 11.1.x vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/MultiLineFunctionDeclarationSniff.php \PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions\MultiLineFunctionDeclarationSniff::isMultiLineDeclaration()
Determine if this is a multi-line function declaration.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
int $openBracket The position of the opening bracket: in the stack passed in $tokens.
array<int, array<string, mixed>> $tokens The stack of tokens that make up: the file.
Return value
bool
Overrides MultiLineFunctionDeclarationSniff::isMultiLineDeclaration
File
-
vendor/
drupal/ coder/ coder_sniffer/ Drupal/ Sniffs/ Functions/ MultiLineFunctionDeclarationSniff.php, line 73
Class
- MultiLineFunctionDeclarationSniff
- Multi-line function declarations need to have a trailing comma on the last parameter. Modified from Squiz, whenever there is a function declaration closing parenthesis on a new line we treat it as multi-line.
Namespace
Drupal\Sniffs\FunctionsCode
public function isMultiLineDeclaration($phpcsFile, $stackPtr, $openBracket, $tokens) {
$function = $tokens[$stackPtr];
if ($tokens[$function['parenthesis_opener']]['line'] === $tokens[$function['parenthesis_closer']]['line']) {
return false;
}
return true;
}