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

Breadcrumb

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

function ScopeHelper::isInSameScope

14 calls to ScopeHelper::isInSameScope()
ArrayHelper::parse in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ArrayHelper.php
*
ClassMemberSpacingSniff::findNextMember in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/ClassMemberSpacingSniff.php
DisallowImplicitArrayCreationSniff::hasExplicitCreation in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Arrays/DisallowImplicitArrayCreationSniff.php
EarlyExitSniff::processIf in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/EarlyExitSniff.php
FunctionHelper::returnsValue in vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/FunctionHelper.php

... See full list

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/ScopeHelper.php, line 16

Class

ScopeHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function isInSameScope(File $phpcsFile, int $firstPointer, int $secondPointer) : bool {
    $tokens = $phpcsFile->getTokens();
    $getScope = static function (int $pointer) use ($tokens) : int {
        $scope = 0;
        foreach (array_reverse($tokens[$pointer]['conditions'], true) as $conditionPointer => $conditionTokenCode) {
            if (!in_array($conditionTokenCode, TokenHelper::$functionTokenCodes, true)) {
                continue;
            }
            $scope = $tokens[$conditionPointer]['level'] + 1;
            break;
        }
        return $scope;
    };
    return $getScope($firstPointer) === $getScope($secondPointer);
}

API Navigation

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