function UseSpacingSniff::process
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *
Parameters
int $openTagPointer:
Overrides Sniff::process
File
-
vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Sniffs/ Namespaces/ UseSpacingSniff.php, line 54
Class
Namespace
SlevomatCodingStandard\Sniffs\NamespacesCode
public function process(File $phpcsFile, $openTagPointer) : void {
$this->linesCountBeforeFirstUse = SniffSettingsHelper::normalizeInteger($this->linesCountBeforeFirstUse);
$this->linesCountBetweenUseTypes = SniffSettingsHelper::normalizeInteger($this->linesCountBetweenUseTypes);
$this->linesCountAfterLastUse = SniffSettingsHelper::normalizeInteger($this->linesCountAfterLastUse);
if (TokenHelper::findPrevious($phpcsFile, T_OPEN_TAG, $openTagPointer - 1) !== null) {
return;
}
$fileUseStatements = UseStatementHelper::getFileUseStatements($phpcsFile);
if (count($fileUseStatements) === 0) {
return;
}
foreach ($fileUseStatements as $useStatementsByName) {
$useStatements = array_values($useStatementsByName);
$this->checkLinesBeforeFirstUse($phpcsFile, $useStatements[0]);
$this->checkLinesAfterLastUse($phpcsFile, $useStatements[count($useStatements) - 1]);
$this->checkLinesBetweenSameTypesOfUse($phpcsFile, $useStatements);
$this->checkLinesBetweenDifferentTypesOfUse($phpcsFile, $useStatements);
}
}