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

Breadcrumb

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

function DeprecatedAnnotationDeclarationSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $docCommentStartPointer:

Overrides Sniff::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/DeprecatedAnnotationDeclarationSniff.php, line 28

Class

DeprecatedAnnotationDeclarationSniff

Namespace

SlevomatCodingStandard\Sniffs\Commenting

Code

public function process(File $phpcsFile, $docCommentStartPointer) : void {
    
    /** @var list<Annotation<DeprecatedTagValueNode>> $annotations */
    $annotations = AnnotationHelper::getAnnotations($phpcsFile, $docCommentStartPointer, '@deprecated');
    if (count($annotations) === 0) {
        return;
    }
    foreach ($annotations as $annotation) {
        if ($annotation->getValue()->description !== '') {
            continue;
        }
        $phpcsFile->addError('Deprecated annotation must have a description.', $annotation->getStartPointer(), self::MISSING_DESCRIPTION);
    }
}
RSS feed
Powered by Drupal