protected function ObjectOperatorIndentSniff::findStartOfline in Coder 8.2
Same name and namespace in other branches
- 8.3 coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php \Drupal\Sniffs\WhiteSpace\ObjectOperatorIndentSniff::findStartOfline()
- 8.3.x coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php \Drupal\Sniffs\WhiteSpace\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 coder_sniffer/
Drupal/ Sniffs/ WhiteSpace/ ObjectOperatorIndentSniff.php - Processes this test, when one of its tokens is encountered.
File
- coder_sniffer/
Drupal/ Sniffs/ WhiteSpace/ ObjectOperatorIndentSniff.php, line 142
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;
}