function AbstractLineCall::getCall
2 calls to AbstractLineCall::getCall()
- RequireMultiLineCallSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Functions/ RequireMultiLineCallSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
- RequireSingleLineCallSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Functions/ RequireSingleLineCallSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Functions/ AbstractLineCall.php, line 54
Class
Namespace
SlevomatCodingStandard\Sniffs\FunctionsCode
protected function getCall(File $phpcsFile, int $parenthesisOpenerPointer, int $parenthesisCloserPointer) : string {
$tokens = $phpcsFile->getTokens();
$pointerBeforeParenthesisCloser = TokenHelper::findPreviousEffective($phpcsFile, $parenthesisCloserPointer - 1);
$endPointer = $tokens[$pointerBeforeParenthesisCloser]['code'] === T_COMMA ? $pointerBeforeParenthesisCloser : $parenthesisCloserPointer;
$call = '';
for ($i = $parenthesisOpenerPointer + 1; $i < $endPointer; $i++) {
if ($tokens[$i]['code'] === T_COMMA) {
$nextPointer = TokenHelper::findNextEffective($phpcsFile, $i + 1);
if ($tokens[$nextPointer]['code'] === T_CLOSE_PARENTHESIS) {
$i = $nextPointer - 1;
continue;
}
}
if ($tokens[$i]['code'] === T_WHITESPACE) {
if ($tokens[$i]['content'] === $phpcsFile->eolChar) {
if ($tokens[$i - 1]['code'] === T_COMMA) {
$call .= ' ';
}
continue;
}
if ($tokens[$i]['column'] === 1) {
// Nothing
continue;
}
}
$call .= $tokens[$i]['content'];
}
return trim($call);
}