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

Breadcrumb

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

function IdentificatorHelper::findEndPointer

10 calls to IdentificatorHelper::findEndPointer()
ConditionHelper::getNegativeConditionPart in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ConditionHelper.php
DisallowIncrementAndDecrementOperatorsSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Operators/DisallowIncrementAndDecrementOperatorsSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
DisallowReferenceSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/PHP/DisallowReferenceSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
ReferenceSpacingSniff::isReference in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/PHP/ReferenceSpacingSniff.php
RequireCombinedAssignmentOperatorSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Operators/RequireCombinedAssignmentOperatorSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

... See full list

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/IdentificatorHelper.php, line 73

Class

IdentificatorHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function findEndPointer(File $phpcsFile, int $startPointer) : ?int {
    $tokens = $phpcsFile->getTokens();
    $nameTokenCodes = TokenHelper::getNameTokenCodes();
    if (in_array($tokens[$startPointer]['code'], $nameTokenCodes, true)) {
        $startPointer = TokenHelper::findNextExcluding($phpcsFile, $nameTokenCodes, $startPointer + 1) - 1;
    }
    elseif ($tokens[$startPointer]['code'] === T_DOLLAR) {
        $startPointer = TokenHelper::findNextEffective($phpcsFile, $startPointer + 1);
    }
    
    /** @var int $nextPointer */
    $nextPointer = TokenHelper::findNextEffective($phpcsFile, $startPointer + 1);
    if (in_array($tokens[$startPointer]['code'], array_merge([
        T_SELF,
        T_STATIC,
        T_PARENT,
    ], $nameTokenCodes), true) && $tokens[$nextPointer]['code'] === T_DOUBLE_COLON) {
        return self::getEndPointerAfterOperator($phpcsFile, $nextPointer);
    }
    if ($tokens[$startPointer]['code'] === T_VARIABLE) {
        if (in_array($tokens[$nextPointer]['code'], [
            T_DOUBLE_COLON,
            T_OBJECT_OPERATOR,
            T_NULLSAFE_OBJECT_OPERATOR,
        ], true)) {
            return self::getEndPointerAfterOperator($phpcsFile, $nextPointer);
        }
        if ($tokens[$nextPointer]['code'] === T_OPEN_SQUARE_BRACKET) {
            return self::getEndPointerAfterVariablePart($phpcsFile, $startPointer);
        }
        return $startPointer;
    }
    return null;
}

API Navigation

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