src/Standards/BestIt/Sniffs/Formatting/TraitUseSpacingSniff.php
private function checkLinesBeforeFirstUse(int $firstUsePos): void
    {
        $posBeforeFirstUse = TokenHelper::findPreviousExcluding($this->getFile(), T_WHITESPACE, $firstUsePos - 1);
        $realLinesBeforeUse = $this->getRealLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse);

        if ($realLinesBeforeUse !== self::LINES_BEFORE_FIRST_USE) {
            $fix = $this->getFile()->addFixableError(
                self::MESSAGE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                $firstUsePos,
                self::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                [
                    self::LINES_BEFORE_FIRST_USE,
                    $realLinesBeforeUse
                ]
            );

            if ($fix) {
                $this->fixLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse, self::LINES_BEFORE_FIRST_USE);
            }
        }
    }
private function checkLinesBeforeFirstUse(int $firstUsePos): void
    {
        $posBeforeFirstUse = TokenHelper::findPreviousExcluding($this->getFile(), T_WHITESPACE, $firstUsePos - 1);
        $realLinesBeforeUse = $this->getRealLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse);

        if ($realLinesBeforeUse !== self::LINES_BEFORE_FIRST_USE) {
            $fix = $this->getFile()->addFixableError(
                self::MESSAGE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                $firstUsePos,
                self::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                [
                    self::LINES_BEFORE_FIRST_USE,
                    $realLinesBeforeUse
                ]
            );

            if ($fix) {
                $this->fixLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse, self::LINES_BEFORE_FIRST_USE);
            }
        }
    }
private function checkLinesBeforeFirstUse ( int $ firstUsePos ) : void { $ posBeforeFirstUse = TokenHelper :: findPreviousExcluding ( $ this -> getFile ( ) , T_WHITESPACE , $ firstUsePos - 1 ) ; $ realLinesBeforeUse = $ this -> getRealLinesBeforeFirstUse ( $ firstUsePos , $ posBeforeFirstUse ) ; if ( $ realLinesBeforeUse !== self :: LINES_BEFORE_FIRST_USE ) { $ fix = $ this -> getFile ( ) -> addFixableError ( self :: MESSAGE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE , $ firstUsePos , self :: CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE , [ self :: LINES_BEFORE_FIRST_USE , $ realLinesBeforeUse ] ) ; if ( $ fix ) { $ this -> fixLinesBeforeFirstUse ( $ firstUsePos , $ posBeforeFirstUse , self :: LINES_BEFORE_FIRST_USE ) ; } } }
Checks the lines before the first usage and registers an error if needed.

@param int $firstUsePos

@return void
Checks the lines before the first usage and registers an error if needed .