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

Breadcrumb

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

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

ObjectOperatorIndentSniff
\Drupal\Sniffs\WhiteSpace\ObjectOperatorIndentSniff.

Namespace

Drupal\Sniffs\WhiteSpace

Code

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;
}

API Navigation

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