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

Breadcrumb

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

function TraitUseSpacingSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $classPointer:

Overrides Sniff::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Classes/TraitUseSpacingSniff.php, line 64

Class

TraitUseSpacingSniff

Namespace

SlevomatCodingStandard\Sniffs\Classes

Code

public function process(File $phpcsFile, $classPointer) : void {
    $this->linesCountBeforeFirstUse = SniffSettingsHelper::normalizeInteger($this->linesCountBeforeFirstUse);
    $this->linesCountBeforeFirstUseWhenFirstInClass = SniffSettingsHelper::normalizeNullableInteger($this->linesCountBeforeFirstUseWhenFirstInClass);
    $this->linesCountBetweenUses = SniffSettingsHelper::normalizeInteger($this->linesCountBetweenUses);
    $this->linesCountAfterLastUse = SniffSettingsHelper::normalizeInteger($this->linesCountAfterLastUse);
    $this->linesCountAfterLastUseWhenLastInClass = SniffSettingsHelper::normalizeInteger($this->linesCountAfterLastUseWhenLastInClass);
    $usePointers = ClassHelper::getTraitUsePointers($phpcsFile, $classPointer);
    if (count($usePointers) === 0) {
        return;
    }
    $this->checkLinesBeforeFirstUse($phpcsFile, $usePointers[0]);
    $this->checkLinesAfterLastUse($phpcsFile, $usePointers[count($usePointers) - 1]);
    $this->checkLinesBetweenUses($phpcsFile, $usePointers);
}
RSS feed
Powered by Drupal