function ObjectOperatorIndentSniff::findStartOfline
Returns the first non whitespace token on the line.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile All the tokens found in the document.:
int $stackPtr The position of the current token: in the stack passed in $tokens.
Return value
int
1 call to ObjectOperatorIndentSniff::findStartOfline()
- ObjectOperatorIndentSniff::process in vendor/
drupal/ coder/ coder_sniffer/ Drupal/ Sniffs/ WhiteSpace/ ObjectOperatorIndentSniff.php - Processes this test, when one of its tokens is encountered.
File
-
vendor/
drupal/ coder/ coder_sniffer/ Drupal/ Sniffs/ WhiteSpace/ ObjectOperatorIndentSniff.php, line 136
Class
Namespace
Drupal\Sniffs\WhiteSpaceCode
protected function findStartOfline(File $phpcsFile, $stackPtr) {
$tokens = $phpcsFile->getTokens();
// Find the first non whitespace character on the previous line.
$startOfLine = $stackPtr;
while ($tokens[$startOfLine - 1]['line'] === $tokens[$startOfLine]['line']) {
$startOfLine--;
}
if ($tokens[$startOfLine]['code'] === T_WHITESPACE) {
$startOfLine++;
}
return $startOfLine;
}