REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.40 KB
Close
/opt/cpanel/ea-wappspector/vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Exceptions/DeadCatchSniff.php
Text
Base64
<?php declare(strict_types = 1); namespace SlevomatCodingStandard\Sniffs\Exceptions; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use SlevomatCodingStandard\Helpers\CatchHelper; use SlevomatCodingStandard\Helpers\TokenHelper; use function in_array; use const T_CATCH; class DeadCatchSniff implements Sniff { public const CODE_CATCH_AFTER_THROWABLE_CATCH = 'CatchAfterThrowableCatch'; /** * @return array<int, (int|string)> */ public function register(): array { return [ T_CATCH, ]; } /** * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * @param int $catchPointer */ public function process(File $phpcsFile, $catchPointer): void { $tokens = $phpcsFile->getTokens(); $catchToken = $tokens[$catchPointer]; $caughtTypes = CatchHelper::findCaughtTypesInCatch($phpcsFile, $catchToken); if (!in_array('\\Throwable', $caughtTypes, true)) { return; } $nextCatchPointer = TokenHelper::findNextEffective($phpcsFile, $catchToken['scope_closer'] + 1); while ($nextCatchPointer !== null) { $nextCatchToken = $tokens[$nextCatchPointer]; if ($nextCatchToken['code'] !== T_CATCH) { break; } $phpcsFile->addError('Unreachable catch block.', $nextCatchPointer, self::CODE_CATCH_AFTER_THROWABLE_CATCH); $nextCatchPointer = TokenHelper::findNextEffective($phpcsFile, $nextCatchToken['scope_closer'] + 1); } } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
DeadCatchSniff.php
1.40 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DisallowNonCapturingCatchSniff.php
1.06 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ReferenceThrowableOnlySniff.php
4.31 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RequireNonCapturingCatchSniff.php
4.29 KB
lrw-r--r--
2025-09-13 08:53:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).