src/Fixer/Alias/NoAliasFunctionsFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $functionsAnalyzer = new FunctionsAnalyzer();

        /** @var \PhpCsFixer\Tokenizer\Token $token */
        foreach ($tokens->findGivenKind(T_STRING) as $index => $token) {
            // check mapping hit
            $tokenContent = strtolower($token->getContent());
            if (!isset($this->aliases[$tokenContent])) {
                continue;
            }

            // skip expressions without parameters list
            $nextToken = $tokens[$tokens->getNextMeaningfulToken($index)];
            if (!$nextToken->equals('(')) {
                continue;
            }

            if (!$functionsAnalyzer->isGlobalFunctionCall($tokens, $index)) {
                continue;
            }

            $tokens[$index] = new Token([T_STRING, $this->aliases[$tokenContent]]);
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $functionsAnalyzer = new FunctionsAnalyzer();

        /** @var \PhpCsFixer\Tokenizer\Token $token */
        foreach ($tokens->findGivenKind(T_STRING) as $index => $token) {
            // check mapping hit
            $tokenContent = strtolower($token->getContent());
            if (!isset($this->aliases[$tokenContent])) {
                continue;
            }

            // skip expressions without parameters list
            $nextToken = $tokens[$tokens->getNextMeaningfulToken($index)];
            if (!$nextToken->equals('(')) {
                continue;
            }

            if (!$functionsAnalyzer->isGlobalFunctionCall($tokens, $index)) {
                continue;
            }

            $tokens[$index] = new Token([T_STRING, $this->aliases[$tokenContent]]);
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ functionsAnalyzer = new FunctionsAnalyzer ( ) ; /** @var \PhpCsFixer\Tokenizer\Token $token */ foreach ( $ tokens -> findGivenKind ( T_STRING ) as $ index => $ token ) { // check mapping hit $ tokenContent = strtolower ( $ token -> getContent ( ) ) ; if ( ! isset ( $ this -> aliases [ $ tokenContent ] ) ) { continue ; } // skip expressions without parameters list $ nextToken = $ tokens [ $ tokens -> getNextMeaningfulToken ( $ index ) ] ; if ( ! $ nextToken -> equals ( '(' ) ) { continue ; } if ( ! $ functionsAnalyzer -> isGlobalFunctionCall ( $ tokens , $ index ) ) { continue ; } $ tokens [ $ index ] = new Token ( [ T_STRING , $ this -> aliases [ $ tokenContent ] ] ) ; } }
{@inheritdoc}
{