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

Breadcrumb

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

function ClassCommentSniff::processVersion

Process the version tag.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:

array $tags The tokens for these tags.:

Return value

void

Overrides FileCommentSniff::processVersion

File

vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Commenting/ClassCommentSniff.php, line 102

Class

ClassCommentSniff

Namespace

PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting

Code

protected function processVersion($phpcsFile, array $tags) {
    $tokens = $phpcsFile->getTokens();
    foreach ($tags as $tag) {
        if ($tokens[$tag + 2]['code'] !== T_DOC_COMMENT_STRING) {
            // No content.
            continue;
        }
        $content = $tokens[$tag + 2]['content'];
        if (strstr($content, 'Release:') === false) {
            $error = 'Invalid version "%s" in doc comment; consider "Release: <package_version>" instead';
            $data = [
                $content,
            ];
            $phpcsFile->addWarning($error, $tag, 'InvalidVersion', $data);
        }
    }
}

API Navigation

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