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

Breadcrumb

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

function DocCommentHelper::isInline

2 calls to DocCommentHelper::isInline()
DocCommentHelper::findDocCommentOwnerPointer in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/DocCommentHelper.php
DocCommentSpacingSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/DocCommentSpacingSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

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

Class

DocCommentHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function isInline(File $phpcsFile, int $docCommentOpenPointer) : bool {
    $tokens = $phpcsFile->getTokens();
    $nextPointer = TokenHelper::findNextNonWhitespace($phpcsFile, $tokens[$docCommentOpenPointer]['comment_closer'] + 1);
    if ($nextPointer !== null && in_array($tokens[$nextPointer]['code'], [
        T_PUBLIC,
        T_PROTECTED,
        T_PRIVATE,
        T_READONLY,
        T_FINAL,
        T_STATIC,
        T_ABSTRACT,
        T_CONST,
        T_CLASS,
        T_INTERFACE,
        T_TRAIT,
        T_ENUM,
    ], true)) {
        return false;
    }
    $parsedDocComment = self::parseDocComment($phpcsFile, $docCommentOpenPointer);
    if ($parsedDocComment === null) {
        return false;
    }
    foreach ($parsedDocComment->getNode()
        ->getTags() as $annotation) {
        if (preg_match('~^@(?:(?:phpstan|psalm)-)?var~i', $annotation->name) === 1) {
            return true;
        }
    }
    return false;
}

API Navigation

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