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

Breadcrumb

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

function ScopeManager::getScopesForScopeEnd

* Find scopes closed by a scope close index. * *

Parameters

string $filename: * @param int $scopeEndIndex * * @return ScopeInfo[]

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/ScopeManager.php, line 82

Class

ScopeManager

Namespace

VariableAnalysis\Lib

Code

public function getScopesForScopeEnd($filename, $scopeEndIndex) {
    $scopePairsForFile = $this->getScopesForFilename($filename);
    $scopeIndicesThisCloses = array_reduce($scopePairsForFile, function ($found, $scope) use ($scopeEndIndex) {
        if (!is_int($scope->scopeEndIndex)) {
            Helpers::debug('No scope closer found for scope start', $scope->scopeStartIndex);
            return $found;
        }
        if ($scopeEndIndex === $scope->scopeEndIndex) {
            $found[] = $scope;
        }
        return $found;
    }, []);
    return $scopeIndicesThisCloses;
}

API Navigation

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