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

Breadcrumb

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

function Helpers::getLastNonEmptyTokenIndexInFile

*

Parameters

File $phpcsFile: * * @return int

2 calls to Helpers::getLastNonEmptyTokenIndexInFile()
Helpers::getArrowFunctionOpenClose in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php
* Find the opening and closing scope positions for an arrow function if the * given position is the start of the arrow function (the `fn` keyword * token). * * Returns null if the passed token is not an arrow function keyword. * * If the…
Helpers::getScopeCloseForScopeOpen in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php
*

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php, line 1203

Class

Helpers

Namespace

VariableAnalysis\Lib

Code

public static function getLastNonEmptyTokenIndexInFile(File $phpcsFile) {
    $tokens = $phpcsFile->getTokens();
    foreach (array_reverse($tokens, true) as $index => $token) {
        if (!in_array($token['code'], self::getPossibleEndOfFileTokens(), true)) {
            return $index;
        }
    }
    self::debug('no non-empty token found for end of file');
    return 0;
}
RSS feed
Powered by Drupal