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

Breadcrumb

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

function CatchHelper::getTryEndPointer

1 call to CatchHelper::getTryEndPointer()
RequireNonCapturingCatchSniff::process in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Exceptions/RequireNonCapturingCatchSniff.php
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/CatchHelper.php, line 18

Class

CatchHelper
@internal

Namespace

SlevomatCodingStandard\Helpers

Code

public static function getTryEndPointer(File $phpcsFile, int $catchPointer) : int {
    $tokens = $phpcsFile->getTokens();
    $endPointer = $tokens[$catchPointer]['scope_closer'];
    do {
        $nextPointer = TokenHelper::findNextEffective($phpcsFile, $endPointer + 1);
        if ($nextPointer === null || !in_array($tokens[$nextPointer]['code'], [
            T_CATCH,
            T_FINALLY,
        ], true)) {
            break;
        }
        $endPointer = $tokens[$nextPointer]['scope_closer'];
    } while (true);
    return $endPointer;
}

API Navigation

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