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

Breadcrumb

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

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

DocCommentSpacingSniff

Namespace

SlevomatCodingStandard\Sniffs\Commenting

Code

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

API Navigation

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