protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        for ($index = $tokens->count() - 1; $index > 0; --$index) {
            $expressionEnd = $tokens[$index];
            if (!$expressionEnd->equalsAny(self::EXPRESSION_END_TOKENS)) {
                continue;
            }

            $numberIndex = $tokens->getPrevMeaningfulToken($index);
            $number = $tokens[$numberIndex];
            if (!$number->isGivenKind(T_LNUMBER) || '1' !== $number->getContent()) {
                continue;
            }

            $operatorIndex = $tokens->getPrevMeaningfulToken($numberIndex);
            $operator = $tokens[$operatorIndex];
            if (!$operator->isGivenKind([T_PLUS_EQUAL, T_MINUS_EQUAL])) {
                continue;
            }

            $startIndex = $this->findStart($tokens, $tokens->getPrevMeaningfulToken($operatorIndex));

            $this->clearRangeLeaveComments(
                $tokens,
                $tokens->getPrevMeaningfulToken($operatorIndex) + 1,
                $numberIndex
            );

            $tokens->insertAt(
                $startIndex,
                new Token($operator->isGivenKind(T_PLUS_EQUAL) ? [T_INC, '++'] : [T_DEC, '--'])
            );
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        for ($index = $tokens->count() - 1; $index > 0; --$index) {
            $expressionEnd = $tokens[$index];
            if (!$expressionEnd->equalsAny(self::EXPRESSION_END_TOKENS)) {
                continue;
            }

            $numberIndex = $tokens->getPrevMeaningfulToken($index);
            $number = $tokens[$numberIndex];
            if (!$number->isGivenKind(T_LNUMBER) || '1' !== $number->getContent()) {
                continue;
            }

            $operatorIndex = $tokens->getPrevMeaningfulToken($numberIndex);
            $operator = $tokens[$operatorIndex];
            if (!$operator->isGivenKind([T_PLUS_EQUAL, T_MINUS_EQUAL])) {
                continue;
            }

            $startIndex = $this->findStart($tokens, $tokens->getPrevMeaningfulToken($operatorIndex));

            $this->clearRangeLeaveComments(
                $tokens,
                $tokens->getPrevMeaningfulToken($operatorIndex) + 1,
                $numberIndex
            );

            $tokens->insertAt(
                $startIndex,
                new Token($operator->isGivenKind(T_PLUS_EQUAL) ? [T_INC, '++'] : [T_DEC, '--'])
            );
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { for ( $ index = $ tokens -> count ( ) - 1 ; $ index > 0 ; -- $ index ) { $ expressionEnd = $ tokens [ $ index ] ; if ( ! $ expressionEnd -> equalsAny ( self :: EXPRESSION_END_TOKENS ) ) { continue ; } $ numberIndex = $ tokens -> getPrevMeaningfulToken ( $ index ) ; $ number = $ tokens [ $ numberIndex ] ; if ( ! $ number -> isGivenKind ( T_LNUMBER ) || '1' !== $ number -> getContent ( ) ) { continue ; } $ operatorIndex = $ tokens -> getPrevMeaningfulToken ( $ numberIndex ) ; $ operator = $ tokens [ $ operatorIndex ] ; if ( ! $ operator -> isGivenKind ( [ T_PLUS_EQUAL , T_MINUS_EQUAL ] ) ) { continue ; } $ startIndex = $ this -> findStart ( $ tokens , $ tokens -> getPrevMeaningfulToken ( $ operatorIndex ) ) ; $ this -> clearRangeLeaveComments ( $ tokens , $ tokens -> getPrevMeaningfulToken ( $ operatorIndex ) + 1 , $ numberIndex ) ; $ tokens -> insertAt ( $ startIndex , new Token ( $ operator -> isGivenKind ( T_PLUS_EQUAL ) ? [ T_INC , '++' ] : [ T_DEC , '--' ] ) ) ; } }
{@inheritdoc}
{