function Comment::collectWhitespace
Collect consecutive whitespace into a single token.
Parameters
string $string The comment string being tokenized.:
int $start The position in the string to start processing.:
int $end The position in the string to end processing.:
Return value
array<string, string|int>|null
2 calls to Comment::collectWhitespace()
- Comment::processLine in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ Comment.php - Process a single line of a comment.
- Comment::tokenizeString in vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ Comment.php - Creates an array of tokens when given some PHP code.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Tokenizers/ Comment.php, line 259
Class
Namespace
PHP_CodeSniffer\TokenizersCode
private function collectWhitespace($string, $start, $end) {
$space = '';
for ($start; $start < $end; $start++) {
if ($string[$start] !== ' ' && $string[$start] !== "\t") {
break;
}
$space .= $string[$start];
}
if ($space === '') {
return null;
}
return [
'content' => $space,
'code' => T_DOC_COMMENT_WHITESPACE,
'type' => 'T_DOC_COMMENT_WHITESPACE',
];
}