function DocCommentSpacingSniff::checkAnnotationsGroups
*
Parameters
list<Annotation> $annotations:
1 call to DocCommentSpacingSniff::checkAnnotationsGroups()
- DocCommentSpacingSniff::process in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Commenting/ DocCommentSpacingSniff.php - * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Commenting/ DocCommentSpacingSniff.php, line 342
Class
Namespace
SlevomatCodingStandard\Sniffs\CommentingCode
private function checkAnnotationsGroups(File $phpcsFile, int $docCommentOpenerPointer, array $annotations) : void {
$tokens = $phpcsFile->getTokens();
$annotationsGroups = [];
$annotationsGroup = [];
$previousAnnotation = null;
foreach ($annotations as $annotation) {
if ($previousAnnotation === null || $tokens[$previousAnnotation->getEndPointer()]['line'] + 1 === $tokens[$annotation->getStartPointer()]['line']) {
$annotationsGroup[] = $annotation;
$previousAnnotation = $annotation;
continue;
}
$annotationsGroups[] = $annotationsGroup;
$annotationsGroup = [
$annotation,
];
$previousAnnotation = $annotation;
}
if (count($annotationsGroup) > 0) {
$annotationsGroups[] = $annotationsGroup;
}
$this->checkAnnotationsGroupsOrder($phpcsFile, $docCommentOpenerPointer, $annotationsGroups, $annotations);
$this->checkLinesBetweenAnnotationsGroups($phpcsFile, $docCommentOpenerPointer, $annotationsGroups);
}