Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Comment.php

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

Comment

Namespace

PHP_CodeSniffer\Tokenizers

Code

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',
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal