protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $insideForParenthesesUntil = null;

        for ($index = 0, $max = \count($tokens) - 1; $index < $max; ++$index) {
            if ($this->configuration['remove_in_empty_for_expressions']) {
                if ($tokens[$index]->isGivenKind(T_FOR)) {
                    $index = $tokens->getNextMeaningfulToken($index);
                    $insideForParenthesesUntil = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $index);

                    continue;
                }

                if ($index === $insideForParenthesesUntil) {
                    $insideForParenthesesUntil = null;

                    continue;
                }
            }

            if (!$tokens[$index]->equals(';')) {
                continue;
            }

            if (!$tokens[$index + 1]->isWhitespace()) {
                if (
                    !$tokens[$index + 1]->equalsAny([')', [T_INLINE_HTML]]) && (
                        !$this->configuration['remove_in_empty_for_expressions']
                        || !$tokens[$index + 1]->equals(';')
                    )
                ) {
                    $tokens->insertAt($index + 1, new Token([T_WHITESPACE, ' ']));
                    ++$max;
                }

                continue;
            }

            if (
                null !== $insideForParenthesesUntil
                && ($tokens[$index + 2]->equals(';') || $index + 2 === $insideForParenthesesUntil)
                && !Preg::match('/\R/', $tokens[$index + 1]->getContent())
            ) {
                $tokens->clearAt($index + 1);

                continue;
            }

            if (
                isset($tokens[$index + 2])
                && !$tokens[$index + 1]->equals([T_WHITESPACE, ' '])
                && $tokens[$index + 1]->isWhitespace(" \t")
                && !$tokens[$index + 2]->isComment()
                && !$tokens[$index + 2]->equals(')')
            ) {
                $tokens[$index + 1] = new Token([T_WHITESPACE, ' ']);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $insideForParenthesesUntil = null;

        for ($index = 0, $max = \count($tokens) - 1; $index < $max; ++$index) {
            if ($this->configuration['remove_in_empty_for_expressions']) {
                if ($tokens[$index]->isGivenKind(T_FOR)) {
                    $index = $tokens->getNextMeaningfulToken($index);
                    $insideForParenthesesUntil = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $index);

                    continue;
                }

                if ($index === $insideForParenthesesUntil) {
                    $insideForParenthesesUntil = null;

                    continue;
                }
            }

            if (!$tokens[$index]->equals(';')) {
                continue;
            }

            if (!$tokens[$index + 1]->isWhitespace()) {
                if (
                    !$tokens[$index + 1]->equalsAny([')', [T_INLINE_HTML]]) && (
                        !$this->configuration['remove_in_empty_for_expressions']
                        || !$tokens[$index + 1]->equals(';')
                    )
                ) {
                    $tokens->insertAt($index + 1, new Token([T_WHITESPACE, ' ']));
                    ++$max;
                }

                continue;
            }

            if (
                null !== $insideForParenthesesUntil
                && ($tokens[$index + 2]->equals(';') || $index + 2 === $insideForParenthesesUntil)
                && !Preg::match('/\R/', $tokens[$index + 1]->getContent())
            ) {
                $tokens->clearAt($index + 1);

                continue;
            }

            if (
                isset($tokens[$index + 2])
                && !$tokens[$index + 1]->equals([T_WHITESPACE, ' '])
                && $tokens[$index + 1]->isWhitespace(" \t")
                && !$tokens[$index + 2]->isComment()
                && !$tokens[$index + 2]->equals(')')
            ) {
                $tokens[$index + 1] = new Token([T_WHITESPACE, ' ']);
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ insideForParenthesesUntil = null ; for ( $ index = 0 , $ max = \ count ( $ tokens ) - 1 ; $ index < $ max ; ++ $ index ) { if ( $ this -> configuration [ 'remove_in_empty_for_expressions' ] ) { if ( $ tokens [ $ index ] -> isGivenKind ( T_FOR ) ) { $ index = $ tokens -> getNextMeaningfulToken ( $ index ) ; $ insideForParenthesesUntil = $ tokens -> findBlockEnd ( Tokens :: BLOCK_TYPE_PARENTHESIS_BRACE , $ index ) ; continue ; } if ( $ index === $ insideForParenthesesUntil ) { $ insideForParenthesesUntil = null ; continue ; } } if ( ! $ tokens [ $ index ] -> equals ( ';' ) ) { continue ; } if ( ! $ tokens [ $ index + 1 ] -> isWhitespace ( ) ) { if ( ! $ tokens [ $ index + 1 ] -> equalsAny ( [ ')' , [ T_INLINE_HTML ] ] ) && ( ! $ this -> configuration [ 'remove_in_empty_for_expressions' ] || ! $ tokens [ $ index + 1 ] -> equals ( ';' ) ) ) { $ tokens -> insertAt ( $ index + 1 , new Token ( [ T_WHITESPACE , ' ' ] ) ) ; ++ $ max ; } continue ; } if ( null !== $ insideForParenthesesUntil && ( $ tokens [ $ index + 2 ] -> equals ( ';' ) || $ index + 2 === $ insideForParenthesesUntil ) && ! Preg :: match ( '/\R/' , $ tokens [ $ index + 1 ] -> getContent ( ) ) ) { $ tokens -> clearAt ( $ index + 1 ) ; continue ; } if ( isset ( $ tokens [ $ index + 2 ] ) && ! $ tokens [ $ index + 1 ] -> equals ( [ T_WHITESPACE , ' ' ] ) && $ tokens [ $ index + 1 ] -> isWhitespace ( " \t" ) && ! $ tokens [ $ index + 2 ] -> isComment ( ) && ! $ tokens [ $ index + 2 ] -> equals ( ')' ) ) { $ tokens [ $ index + 1 ] = new Token ( [ T_WHITESPACE , ' ' ] ) ; } } }
{@inheritdoc}
{