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

Breadcrumb

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

function JumpStatementsSpacingSniff::isThrowExpression

2 calls to JumpStatementsSpacingSniff::isThrowExpression()
JumpStatementsSpacingSniff::checkLinesAfter in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/JumpStatementsSpacingSniff.php
JumpStatementsSpacingSniff::checkLinesBefore in vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/JumpStatementsSpacingSniff.php

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/ControlStructures/JumpStatementsSpacingSniff.php, line 224

Class

JumpStatementsSpacingSniff

Namespace

SlevomatCodingStandard\Sniffs\ControlStructures

Code

private function isThrowExpression(File $phpcsFile, int $jumpStatementPointer) : bool {
    $tokens = $phpcsFile->getTokens();
    if ($tokens[$jumpStatementPointer]['code'] !== T_THROW) {
        return false;
    }
    $pointerBefore = TokenHelper::findPreviousEffective($phpcsFile, $jumpStatementPointer - 1);
    return !in_array($tokens[$pointerBefore]['code'], [
        T_SEMICOLON,
        T_COLON,
        T_OPEN_CURLY_BRACKET,
        T_CLOSE_CURLY_BRACKET,
        T_OPEN_TAG,
    ], true);
}

API Navigation

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