src/Fixer/ControlStructure/YodaStyleFixer.php
private function fixTokens(Tokens $tokens)
    {
        for ($i = \count($tokens) - 1; $i > 1; --$i) {
            if ($tokens[$i]->isGivenKind($this->candidateTypes)) {
                $yoda = $this->candidateTypesConfiguration[$tokens[$i]->getId()];
            } elseif (
                ($tokens[$i]->equals('<') && \in_array('<', $this->candidateTypes, true))
                || ($tokens[$i]->equals('>') && \in_array('>', $this->candidateTypes, true))
            ) {
                $yoda = $this->candidateTypesConfiguration[$tokens[$i]->getContent()];
            } else {
                continue;
            }

            $fixableCompareInfo = $this->getCompareFixableInfo($tokens, $i, $yoda);
            if (null === $fixableCompareInfo) {
                continue;
            }

            $i = $this->fixTokensCompare(
                $tokens,
                $fixableCompareInfo['left']['start'],
                $fixableCompareInfo['left']['end'],
                $i,
                $fixableCompareInfo['right']['start'],
                $fixableCompareInfo['right']['end']
            );
        }

        return $tokens;
    }
private function fixTokens(Tokens $tokens)
    {
        for ($i = \count($tokens) - 1; $i > 1; --$i) {
            if ($tokens[$i]->isGivenKind($this->candidateTypes)) {
                $yoda = $this->candidateTypesConfiguration[$tokens[$i]->getId()];
            } elseif (
                ($tokens[$i]->equals('<') && \in_array('<', $this->candidateTypes, true))
                || ($tokens[$i]->equals('>') && \in_array('>', $this->candidateTypes, true))
            ) {
                $yoda = $this->candidateTypesConfiguration[$tokens[$i]->getContent()];
            } else {
                continue;
            }

            $fixableCompareInfo = $this->getCompareFixableInfo($tokens, $i, $yoda);
            if (null === $fixableCompareInfo) {
                continue;
            }

            $i = $this->fixTokensCompare(
                $tokens,
                $fixableCompareInfo['left']['start'],
                $fixableCompareInfo['left']['end'],
                $i,
                $fixableCompareInfo['right']['start'],
                $fixableCompareInfo['right']['end']
            );
        }

        return $tokens;
    }
private function fixTokens ( Tokens $ tokens ) { for ( $ i = \ count ( $ tokens ) - 1 ; $ i > 1 ; -- $ i ) { if ( $ tokens [ $ i ] -> isGivenKind ( $ this -> candidateTypes ) ) { $ yoda = $ this -> candidateTypesConfiguration [ $ tokens [ $ i ] -> getId ( ) ] ; } elseif ( ( $ tokens [ $ i ] -> equals ( '<' ) && \ in_array ( '<' , $ this -> candidateTypes , true ) ) || ( $ tokens [ $ i ] -> equals ( '>' ) && \ in_array ( '>' , $ this -> candidateTypes , true ) ) ) { $ yoda = $ this -> candidateTypesConfiguration [ $ tokens [ $ i ] -> getContent ( ) ] ; } else { continue ; } $ fixableCompareInfo = $ this -> getCompareFixableInfo ( $ tokens , $ i , $ yoda ) ; if ( null === $ fixableCompareInfo ) { continue ; } $ i = $ this -> fixTokensCompare ( $ tokens , $ fixableCompareInfo [ 'left' ] [ 'start' ] , $ fixableCompareInfo [ 'left' ] [ 'end' ] , $ i , $ fixableCompareInfo [ 'right' ] [ 'start' ] , $ fixableCompareInfo [ 'right' ] [ 'end' ] ) ; } return $ tokens ; }
@param Tokens $tokens

@return Tokens
@param Tokens $tokens