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\HelpersCode
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;
}