protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        foreach ($tokens as $index => $token) {
            if (!$token->isGivenKind([T_VARIABLE, T_STRING])) {
                continue;
            }

            $replaced = Preg::replaceCallback('/[^[:ascii:]]/u', static function ($matches) {
                return isset(self::$replacements[$matches[0]])
                    ? self::$replacements[$matches[0]]
                    : $matches[0]
                ;
            }, $token->getContent(), -1, $count);

            if ($count) {
                $tokens->offsetSet($index, new Token([$token->getId(), $replaced]));
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        foreach ($tokens as $index => $token) {
            if (!$token->isGivenKind([T_VARIABLE, T_STRING])) {
                continue;
            }

            $replaced = Preg::replaceCallback('/[^[:ascii:]]/u', static function ($matches) {
                return isset(self::$replacements[$matches[0]])
                    ? self::$replacements[$matches[0]]
                    : $matches[0]
                ;
            }, $token->getContent(), -1, $count);

            if ($count) {
                $tokens->offsetSet($index, new Token([$token->getId(), $replaced]));
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { foreach ( $ tokens as $ index => $ token ) { if ( ! $ token -> isGivenKind ( [ T_VARIABLE , T_STRING ] ) ) { continue ; } $ replaced = Preg :: replaceCallback ( '/[^[:ascii:]]/u' , static function ( $ matches ) { return isset ( self :: $ replacements [ $ matches [ 0 ] ] ) ? self :: $ replacements [ $ matches [ 0 ] ] : $ matches [ 0 ] ; } , $ token -> getContent ( ) , - 1 , $ count ) ; if ( $ count ) { $ tokens -> offsetSet ( $ index , new Token ( [ $ token -> getId ( ) , $ replaced ] ) ) ; } } }
{@inheritdoc}
{