protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $this->tokensAnalyzer = new TokensAnalyzer($tokens);

        // last and first tokens cannot be an operator
        for ($index = $tokens->count() - 2; $index > 0; --$index) {
            if (!$this->tokensAnalyzer->isBinaryOperator($index)) {
                continue;
            }

            if ('=' === $tokens[$index]->getContent()) {
                $isDeclare = $this->isEqualPartOfDeclareStatement($tokens, $index);
                if (false === $isDeclare) {
                    $this->fixWhiteSpaceAroundOperator($tokens, $index);
                } else {
                    $index = $isDeclare; // skip `declare(foo ==bar)`, see `declare_equal_normalize`
                }
            } else {
                $this->fixWhiteSpaceAroundOperator($tokens, $index);
            }

            // previous of binary operator is now never an operator / previous of declare statement cannot be an operator
            --$index;
        }

        if (\count($this->alignOperatorTokens)) {
            $this->fixAlignment($tokens, $this->alignOperatorTokens);
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $this->tokensAnalyzer = new TokensAnalyzer($tokens);

        
        for ($index = $tokens->count() - 2; $index > 0; --$index) {
            if (!$this->tokensAnalyzer->isBinaryOperator($index)) {
                continue;
            }

            if ('=' === $tokens[$index]->getContent()) {
                $isDeclare = $this->isEqualPartOfDeclareStatement($tokens, $index);
                if (false === $isDeclare) {
                    $this->fixWhiteSpaceAroundOperator($tokens, $index);
                } else {
                    $index = $isDeclare; 
                }
            } else {
                $this->fixWhiteSpaceAroundOperator($tokens, $index);
            }

            
            --$index;
        }

        if (\count($this->alignOperatorTokens)) {
            $this->fixAlignment($tokens, $this->alignOperatorTokens);
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ this -> tokensAnalyzer = new TokensAnalyzer ( $ tokens ) ; // last and first tokens cannot be an operator for ( $ index = $ tokens -> count ( ) - 2 ; $ index > 0 ; -- $ index ) { if ( ! $ this -> tokensAnalyzer -> isBinaryOperator ( $ index ) ) { continue ; } if ( '=' === $ tokens [ $ index ] -> getContent ( ) ) { $ isDeclare = $ this -> isEqualPartOfDeclareStatement ( $ tokens , $ index ) ; if ( false === $ isDeclare ) { $ this -> fixWhiteSpaceAroundOperator ( $ tokens , $ index ) ; } else { $ index = $ isDeclare ; // skip `declare(foo ==bar)`, see `declare_equal_normalize` } } else { $ this -> fixWhiteSpaceAroundOperator ( $ tokens , $ index ) ; } // previous of binary operator is now never an operator / previous of declare statement cannot be an operator -- $ index ; } if ( \ count ( $ this -> alignOperatorTokens ) ) { $ this -> fixAlignment ( $ tokens , $ this -> alignOperatorTokens ) ; } }
{@inheritdoc}
{