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

Breadcrumb

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

function MultipleUsesPerLineSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $usePointer:

Overrides Sniff::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Namespaces/MultipleUsesPerLineSniff.php, line 32

Class

MultipleUsesPerLineSniff

Namespace

SlevomatCodingStandard\Sniffs\Namespaces

Code

public function process(File $phpcsFile, $usePointer) : void {
    if (!UseStatementHelper::isImportUse($phpcsFile, $usePointer)) {
        return;
    }
    $endPointer = TokenHelper::findNext($phpcsFile, T_SEMICOLON, $usePointer + 1);
    $commaPointer = TokenHelper::findNext($phpcsFile, T_COMMA, $usePointer + 1, $endPointer);
    if ($commaPointer === null) {
        return;
    }
    $phpcsFile->addError('Multiple used types per use statement are forbidden.', $commaPointer, self::CODE_MULTIPLE_USES_PER_LINE);
}
RSS feed
Powered by Drupal