src/Standards/BestIt/Sniffs/Formatting/TraitUseSpacingSniff.php
private function getRealLinesAfterLastUse(int $lastUseEndPos): array
    {
        $file = $this->getFile();
        $tokens = $file->getTokens();
        $whitespaceEnd = TokenHelper::findNextExcluding($file, T_WHITESPACE, $lastUseEndPos + 1) - 1;

        if ($lastUseEndPos !== $whitespaceEnd && $tokens[$whitespaceEnd]['content'] !== $file->eolChar) {
            $lastEolPos = TokenHelper::findPreviousContent(
                $file,
                T_WHITESPACE,
                $file->eolChar,
                $whitespaceEnd - 1,
                $lastUseEndPos
            );
            $whitespaceEnd = $lastEolPos ?? $lastUseEndPos;
        }

        $whitespaceAfterLastUse = TokenHelper::getContent($file, $lastUseEndPos + 1, $whitespaceEnd);

        $realLinesAfterUse = substr_count($whitespaceAfterLastUse, $file->eolChar) - 1;

        return [$realLinesAfterUse, $whitespaceEnd];
    }
private function getRealLinesAfterLastUse(int $lastUseEndPos): array
    {
        $file = $this->getFile();
        $tokens = $file->getTokens();
        $whitespaceEnd = TokenHelper::findNextExcluding($file, T_WHITESPACE, $lastUseEndPos + 1) - 1;

        if ($lastUseEndPos !== $whitespaceEnd && $tokens[$whitespaceEnd]['content'] !== $file->eolChar) {
            $lastEolPos = TokenHelper::findPreviousContent(
                $file,
                T_WHITESPACE,
                $file->eolChar,
                $whitespaceEnd - 1,
                $lastUseEndPos
            );
            $whitespaceEnd = $lastEolPos ?? $lastUseEndPos;
        }

        $whitespaceAfterLastUse = TokenHelper::getContent($file, $lastUseEndPos + 1, $whitespaceEnd);

        $realLinesAfterUse = substr_count($whitespaceAfterLastUse, $file->eolChar) - 1;

        return [$realLinesAfterUse, $whitespaceEnd];
    }
private function getRealLinesAfterLastUse ( int $ lastUseEndPos ) : array { $ file = $ this -> getFile ( ) ; $ tokens = $ file -> getTokens ( ) ; $ whitespaceEnd = TokenHelper :: findNextExcluding ( $ file , T_WHITESPACE , $ lastUseEndPos + 1 ) - 1 ; if ( $ lastUseEndPos !== $ whitespaceEnd && $ tokens [ $ whitespaceEnd ] [ 'content' ] !== $ file -> eolChar ) { $ lastEolPos = TokenHelper :: findPreviousContent ( $ file , T_WHITESPACE , $ file -> eolChar , $ whitespaceEnd - 1 , $ lastUseEndPos ) ; $ whitespaceEnd = $ lastEolPos ?? $ lastUseEndPos ; } $ whitespaceAfterLastUse = TokenHelper :: getContent ( $ file , $ lastUseEndPos + 1 , $ whitespaceEnd ) ; $ realLinesAfterUse = substr_count ( $ whitespaceAfterLastUse , $ file -> eolChar ) - 1 ; return [ $ realLinesAfterUse , $ whitespaceEnd ] ; }
Gets the real lines after the last use.

@param int $lastUseEndPos

@return array The first element is the line count, and the second element is when the whitespace ends.
Gets the real lines after the last use .