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

Breadcrumb

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

function ParsedDocComment::getNodeEndPointer

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ParsedDocComment.php, line 79

Class

ParsedDocComment
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public function getNodeEndPointer(File $phpcsFile, Node $node, int $nodeStartPointer) : int {
    $tokens = $phpcsFile->getTokens();
    $content = trim($this->tokens
        ->getContentBetween($node->getAttribute(Attribute::START_INDEX), $node->getAttribute(Attribute::END_INDEX) + 1));
    $length = strlen($content);
    $searchPointer = $nodeStartPointer;
    $content = '';
    for ($i = $nodeStartPointer; $i < count($tokens); $i++) {
        $content .= $tokens[$i]['content'];
        if (strlen($content) >= $length) {
            $searchPointer = $i;
            break;
        }
    }
    return TokenHelper::findPrevious($phpcsFile, array_merge(TokenHelper::$annotationTokenCodes, [
        T_DOC_COMMENT_STRING,
    ]), $searchPointer);
}

API Navigation

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