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

Breadcrumb

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

function InlineDocCommentDeclarationSniff::isAssignment

1 call to InlineDocCommentDeclarationSniff::isAssignment()
InlineDocCommentDeclarationSniff::checkVariable in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/InlineDocCommentDeclarationSniff.php
*

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Commenting/InlineDocCommentDeclarationSniff.php, line 482

Class

InlineDocCommentDeclarationSniff

Namespace

SlevomatCodingStandard\Sniffs\Commenting

Code

private function isAssignment(File $phpcsFile, int $pointer) : bool {
    $tokens = $phpcsFile->getTokens();
    $pointerAfterVariable = TokenHelper::findNextEffective($phpcsFile, $pointer + 1);
    if ($tokens[$pointerAfterVariable]['code'] === T_SEMICOLON) {
        $pointerBeforeVariable = TokenHelper::findPreviousEffective($phpcsFile, $pointer - 1);
        return $tokens[$pointerBeforeVariable]['code'] === T_STATIC;
    }
    return in_array($tokens[$pointerAfterVariable]['code'], [
        T_EQUAL,
        T_COALESCE_EQUAL,
    ], true);
}
RSS feed
Powered by Drupal