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

Breadcrumb

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

function UnusedVariableSniff::findNestedParenthesisWithOwner

2 calls to UnusedVariableSniff::findNestedParenthesisWithOwner()
UnusedVariableSniff::isUsedInLoopCycle in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UnusedVariableSniff.php
UnusedVariableSniff::isValueInForeachAndErrorIsIgnored in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UnusedVariableSniff.php

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/UnusedVariableSniff.php, line 666

Class

UnusedVariableSniff

Namespace

SlevomatCodingStandard\Sniffs\Variables

Code

private function findNestedParenthesisWithOwner(File $phpcsFile, int $pointer) : ?int {
    $tokens = $phpcsFile->getTokens();
    if (!array_key_exists('nested_parenthesis', $tokens[$pointer])) {
        return null;
    }
    foreach (array_reverse(array_keys($tokens[$pointer]['nested_parenthesis'])) as $nestedParenthesisOpener) {
        if (array_key_exists('parenthesis_owner', $tokens[$nestedParenthesisOpener])) {
            return $tokens[$nestedParenthesisOpener]['parenthesis_owner'];
        }
    }
    return null;
}

API Navigation

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