function AbstractArraySniff::getNext
Find next separator in array - either: comma or double arrow.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The current file being checked.:
int $ptr The position of current token.:
int $arrayEnd The token that ends the array definition.:
Return value
int
1 call to AbstractArraySniff::getNext()
- AbstractArraySniff::process in vendor/
squizlabs/ php_codesniffer/ src/ Sniffs/ AbstractArraySniff.php - Processes this sniff, when one of its tokens is encountered.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Sniffs/ AbstractArraySniff.php, line 113
Class
Namespace
PHP_CodeSniffer\SniffsCode
private function getNext(File $phpcsFile, $ptr, $arrayEnd) {
$tokens = $phpcsFile->getTokens();
while ($ptr < $arrayEnd) {
if (isset($tokens[$ptr]['scope_closer']) === true) {
$ptr = $tokens[$ptr]['scope_closer'];
}
else {
if (isset($tokens[$ptr]['parenthesis_closer']) === true) {
$ptr = $tokens[$ptr]['parenthesis_closer'];
}
else {
if (isset($tokens[$ptr]['bracket_closer']) === true) {
$ptr = $tokens[$ptr]['bracket_closer'];
}
}
}
if ($tokens[$ptr]['code'] === T_COMMA || $tokens[$ptr]['code'] === T_DOUBLE_ARROW) {
return $ptr;
}
++$ptr;
}
return $ptr;
}