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

Breadcrumb

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

function EmptyCommentSniff::getCommentContent

3 calls to EmptyCommentSniff::getCommentContent()
EmptyCommentSniff::isNonEmptyLineCommentAfter in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php
EmptyCommentSniff::isNonEmptyLineCommentBefore in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php
EmptyCommentSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php, line 115

Class

EmptyCommentSniff

Namespace

SlevomatCodingStandard\Sniffs\Commenting

Code

private function getCommentContent(File $phpcsFile, int $commentStartPointer, int $commentEndPointer) : string {
    $tokens = $phpcsFile->getTokens();
    if ($tokens[$commentStartPointer]['code'] === T_DOC_COMMENT_OPEN_TAG) {
        return TokenHelper::getContent($phpcsFile, $commentStartPointer + 1, $commentEndPointer - 1);
    }
    if (preg_match('~^(?://|#)(.*)~', $tokens[$commentStartPointer]['content'], $matches) !== 0) {
        return $matches[1];
    }
    return substr(TokenHelper::getContent($phpcsFile, $commentStartPointer, $commentEndPointer), 2, -2);
}
RSS feed
Powered by Drupal