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

Breadcrumb

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

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

AbstractArraySniff

Namespace

PHP_CodeSniffer\Sniffs

Code

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

API Navigation

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