protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $tokenCount = \count($tokens);

        for ($index = 1; $index < $tokenCount; ++$index) {
            if (!$tokens[$index]->isGivenKind(T_FUNCTION)) {
                continue;
            }

            $functionOpenIndex = $tokens->getNextTokenOfKind($index, ['{', ';']);
            if ($tokens[$functionOpenIndex]->equals(';')) { // abstract function
                $index = $functionOpenIndex - 1;

                continue;
            }

            $functionCloseIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $functionOpenIndex);

            $tokensAdded = $this->fixFunction(
                $tokens,
                $index,
                $functionOpenIndex,
                $functionCloseIndex
            );

            $index = $functionCloseIndex + $tokensAdded;
            $tokenCount += $tokensAdded;
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $tokenCount = \count($tokens);

        for ($index = 1; $index < $tokenCount; ++$index) {
            if (!$tokens[$index]->isGivenKind(T_FUNCTION)) {
                continue;
            }

            $functionOpenIndex = $tokens->getNextTokenOfKind($index, ['{', ';']);
            if ($tokens[$functionOpenIndex]->equals(';')) { 
                $index = $functionOpenIndex - 1;

                continue;
            }

            $functionCloseIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_CURLY_BRACE, $functionOpenIndex);

            $tokensAdded = $this->fixFunction(
                $tokens,
                $index,
                $functionOpenIndex,
                $functionCloseIndex
            );

            $index = $functionCloseIndex + $tokensAdded;
            $tokenCount += $tokensAdded;
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ tokenCount = \ count ( $ tokens ) ; for ( $ index = 1 ; $ index < $ tokenCount ; ++ $ index ) { if ( ! $ tokens [ $ index ] -> isGivenKind ( T_FUNCTION ) ) { continue ; } $ functionOpenIndex = $ tokens -> getNextTokenOfKind ( $ index , [ '{' , ';' ] ) ; if ( $ tokens [ $ functionOpenIndex ] -> equals ( ';' ) ) { // abstract function $ index = $ functionOpenIndex - 1 ; continue ; } $ functionCloseIndex = $ tokens -> findBlockEnd ( Tokens :: BLOCK_TYPE_CURLY_BRACE , $ functionOpenIndex ) ; $ tokensAdded = $ this -> fixFunction ( $ tokens , $ index , $ functionOpenIndex , $ functionCloseIndex ) ; $ index = $ functionCloseIndex + $ tokensAdded ; $ tokenCount += $ tokensAdded ; } }
{@inheritdoc}
{