function ParsedDocComment::getNodeEndPointer
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Helpers/ ParsedDocComment.php, line 79
Class
- ParsedDocComment
- @internal
Namespace
SlevomatCodingStandard\HelpersCode
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);
}