src/Standards/BestIt/Sniffs/Formatting/TraitUseDeclarationSniff.php
private function checkDeclaration(int $usePos): void
    {
        $file = $this->getFile()->getBaseFile();

        if (TokenHelper::findNextLocal($file, T_COMMA, $usePos + 1)) {
            $endPos = TokenHelper::findNext($file, [T_OPEN_CURLY_BRACKET, T_SEMICOLON], $usePos + 1);
            $tokens = $file->getTokens();

            if ($tokens[$endPos]['code'] === T_OPEN_CURLY_BRACKET) {
                $file->addError(
                    self::MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION,
                    $usePos,
                    static::CODE_MULTIPLE_TRAITS_PER_DECLARATION
                );
            } else {
                $fix = $file->addFixableError(
                    self::MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION,
                    $usePos,
                    static::CODE_MULTIPLE_TRAITS_PER_DECLARATION
                );

                if ($fix) {
                    $this->fixeUse($endPos, $usePos);
                }
            }
        }
    }
private function checkDeclaration(int $usePos): void
    {
        $file = $this->getFile()->getBaseFile();

        if (TokenHelper::findNextLocal($file, T_COMMA, $usePos + 1)) {
            $endPos = TokenHelper::findNext($file, [T_OPEN_CURLY_BRACKET, T_SEMICOLON], $usePos + 1);
            $tokens = $file->getTokens();

            if ($tokens[$endPos]['code'] === T_OPEN_CURLY_BRACKET) {
                $file->addError(
                    self::MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION,
                    $usePos,
                    static::CODE_MULTIPLE_TRAITS_PER_DECLARATION
                );
            } else {
                $fix = $file->addFixableError(
                    self::MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION,
                    $usePos,
                    static::CODE_MULTIPLE_TRAITS_PER_DECLARATION
                );

                if ($fix) {
                    $this->fixeUse($endPos, $usePos);
                }
            }
        }
    }
private function checkDeclaration ( int $ usePos ) : void { $ file = $ this -> getFile ( ) -> getBaseFile ( ) ; if ( TokenHelper :: findNextLocal ( $ file , T_COMMA , $ usePos + 1 ) ) { $ endPos = TokenHelper :: findNext ( $ file , [ T_OPEN_CURLY_BRACKET , T_SEMICOLON ] , $ usePos + 1 ) ; $ tokens = $ file -> getTokens ( ) ; if ( $ tokens [ $ endPos ] [ 'code' ] === T_OPEN_CURLY_BRACKET ) { $ file -> addError ( self :: MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION , $ usePos , static :: CODE_MULTIPLE_TRAITS_PER_DECLARATION ) ; } else { $ fix = $ file -> addFixableError ( self :: MESSAGE_MULTIPLE_TRAITS_PER_DECLARATION , $ usePos , static :: CODE_MULTIPLE_TRAITS_PER_DECLARATION ) ; if ( $ fix ) { $ this -> fixeUse ( $ endPos , $ usePos ) ; } } } }
Checks the declaration of the given use position and registers and error if needed.

@param int $usePos

@return void
Checks the declaration of the given use position and registers and error if needed .