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

Breadcrumb

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

function DocCommentHelper::findDocCommentOpenPointer

21 calls to DocCommentHelper::findDocCommentOpenPointer()
AnnotationHelper::getAnnotations in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/AnnotationHelper.php
*
ClassStructureSniff::findGroupStartPointer in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/ClassStructureSniff.php
DisallowMultiConstantDefinitionSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/DisallowMultiConstantDefinitionSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
DisallowMultiPropertyDefinitionSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/DisallowMultiPropertyDefinitionSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
DisallowOneLinePropertyDocCommentSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/DisallowOneLinePropertyDocCommentSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

... See full list

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/DocCommentHelper.php, line 151

Class

DocCommentHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function findDocCommentOpenPointer(File $phpcsFile, int $pointer) : ?int {
    return SniffLocalCache::getAndSetIfNotCached($phpcsFile, sprintf('doc-comment-open-pointer-%d', $pointer), static function () use ($phpcsFile, $pointer) : ?int {
        $tokens = $phpcsFile->getTokens();
        if ($tokens[$pointer]['code'] === T_DOC_COMMENT_OPEN_TAG) {
            return $pointer;
        }
        $found = TokenHelper::findPrevious($phpcsFile, [
            T_DOC_COMMENT_CLOSE_TAG,
            T_SEMICOLON,
            T_CLOSE_CURLY_BRACKET,
            T_OPEN_CURLY_BRACKET,
        ], $pointer - 1);
        if ($found !== null && $tokens[$found]['code'] === T_DOC_COMMENT_CLOSE_TAG) {
            return $tokens[$found]['comment_opener'];
        }
        return null;
    });
}

API Navigation

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