function ForbiddenClassesSniff::getAllReferences
*
Return value
list<array{fullyQualifiedName: string, startPointer: int|null, endPointer: int|null}>
1 call to ForbiddenClassesSniff::getAllReferences()
- ForbiddenClassesSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ ForbiddenClassesSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ PHP/ ForbiddenClassesSniff.php, line 221
Class
Namespace
SlevomatCodingStandard\Sniffs\PHPCode
private function getAllReferences(File $phpcsFile, int $startPointer, int $endPointer) : array {
// Always ignore first token
$startPointer++;
$references = [];
while ($startPointer < $endPointer) {
$nextComma = TokenHelper::findNext($phpcsFile, [
T_COMMA,
], $startPointer + 1);
$nextSeparator = min($endPointer, $nextComma ?? PHP_INT_MAX);
$reference = ReferencedNameHelper::getReferenceName($phpcsFile, $startPointer, $nextSeparator - 1);
if (strlen($reference) !== 0 && !in_array(strtolower($reference), self::$keywordReferences, true)) {
$references[] = [
'fullyQualifiedName' => NamespaceHelper::resolveClassName($phpcsFile, $reference, $startPointer),
'startPointer' => TokenHelper::findNextEffective($phpcsFile, $startPointer, $endPointer),
'endPointer' => TokenHelper::findPreviousEffective($phpcsFile, $nextSeparator - 1, $startPointer),
];
}
$startPointer = $nextSeparator + 1;
}
return $references;
}