src/Standards/BestIt/Sniffs/Formatting/TraitUseSpacingSniff.php
private function checkLinesBetweenUses(): void
    {
        $file = $this->getFile();
        $previousUsePos = null;

        foreach ($this->uses as $usePos) {
            if ($previousUsePos === null) {
                $previousUsePos = $usePos;
                continue;
            }

            $posBeforeUse = TokenHelper::findPreviousEffective($file, $usePos - 1);
            $previousUseEndPos = TokenHelper::findNextLocal(
                $file,
                [T_SEMICOLON, T_OPEN_CURLY_BRACKET],
                $previousUsePos + 1
            );

            $realLinesBetweenUse = $this->getRealLinesBetweenUses(
                $previousUseEndPos,
                $usePos
            );

            $previousUsePos = $usePos;

            if ($realLinesBetweenUse !== self::LINES_BETWEEN_USES) {
                $errorParameters = [
                    self::MESSAGE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    $usePos,
                    self::CODE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    [
                        self::LINES_BETWEEN_USES,
                        $realLinesBetweenUse
                    ]
                ];

                if ($previousUseEndPos !== $posBeforeUse) {
                    $file->addError(...$errorParameters);
                } else {
                    $fix = $file->addFixableError(...$errorParameters);

                    if ($fix) {
                        $this->fixLinesBetweenUses($usePos, $previousUseEndPos, self::LINES_BETWEEN_USES);
                    }
                }
            }
        }
    }
private function checkLinesBetweenUses(): void
    {
        $file = $this->getFile();
        $previousUsePos = null;

        foreach ($this->uses as $usePos) {
            if ($previousUsePos === null) {
                $previousUsePos = $usePos;
                continue;
            }

            $posBeforeUse = TokenHelper::findPreviousEffective($file, $usePos - 1);
            $previousUseEndPos = TokenHelper::findNextLocal(
                $file,
                [T_SEMICOLON, T_OPEN_CURLY_BRACKET],
                $previousUsePos + 1
            );

            $realLinesBetweenUse = $this->getRealLinesBetweenUses(
                $previousUseEndPos,
                $usePos
            );

            $previousUsePos = $usePos;

            if ($realLinesBetweenUse !== self::LINES_BETWEEN_USES) {
                $errorParameters = [
                    self::MESSAGE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    $usePos,
                    self::CODE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    [
                        self::LINES_BETWEEN_USES,
                        $realLinesBetweenUse
                    ]
                ];

                if ($previousUseEndPos !== $posBeforeUse) {
                    $file->addError(...$errorParameters);
                } else {
                    $fix = $file->addFixableError(...$errorParameters);

                    if ($fix) {
                        $this->fixLinesBetweenUses($usePos, $previousUseEndPos, self::LINES_BETWEEN_USES);
                    }
                }
            }
        }
    }
private function checkLinesBetweenUses ( ) : void { $ file = $ this -> getFile ( ) ; $ previousUsePos = null ; foreach ( $ this -> uses as $ usePos ) { if ( $ previousUsePos === null ) { $ previousUsePos = $ usePos ; continue ; } $ posBeforeUse = TokenHelper :: findPreviousEffective ( $ file , $ usePos - 1 ) ; $ previousUseEndPos = TokenHelper :: findNextLocal ( $ file , [ T_SEMICOLON , T_OPEN_CURLY_BRACKET ] , $ previousUsePos + 1 ) ; $ realLinesBetweenUse = $ this -> getRealLinesBetweenUses ( $ previousUseEndPos , $ usePos ) ; $ previousUsePos = $ usePos ; if ( $ realLinesBetweenUse !== self :: LINES_BETWEEN_USES ) { $ errorParameters = [ self :: MESSAGE_INCORRECT_LINES_COUNT_BETWEEN_USES , $ usePos , self :: CODE_INCORRECT_LINES_COUNT_BETWEEN_USES , [ self :: LINES_BETWEEN_USES , $ realLinesBetweenUse ] ] ; if ( $ previousUseEndPos !== $ posBeforeUse ) { $ file -> addError ( ... $ errorParameters ) ; } else { $ fix = $ file -> addFixableError ( ... $ errorParameters ) ; if ( $ fix ) { $ this -> fixLinesBetweenUses ( $ usePos , $ previousUseEndPos , self :: LINES_BETWEEN_USES ) ; } } } } }
Checks the lines between uses and registers an erro rif needed.

@return void
Checks the lines between uses and registers an erro rif needed .