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
Namespace
VariableAnalysis\LibCode
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;
}