src/Fixer/LanguageConstruct/ErrorSuppressionFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $functionsAnalyzer = new FunctionsAnalyzer();
        $excludedFunctions = array_map(function ($function) {
            return strtolower($function);
        }, $this->configuration[self::OPTION_NOISE_REMAINING_USAGES_EXCLUDE]);

        for ($index = $tokens->count() - 1; $index >= 0; --$index) {
            $token = $tokens[$index];

            if ($this->configuration[self::OPTION_NOISE_REMAINING_USAGES] && $token->equals('@')) {
                $tokens->clearAt($index);

                continue;
            }

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

            $functionIndex = $index;
            $startIndex = $index;
            $prevIndex = $tokens->getPrevMeaningfulToken($index);
            if ($tokens[$prevIndex]->isGivenKind(T_NS_SEPARATOR)) {
                $startIndex = $prevIndex;
                $prevIndex = $tokens->getPrevMeaningfulToken($startIndex);
            }

            $index = $prevIndex;

            if ($this->isDeprecationErrorCall($tokens, $functionIndex)) {
                if (!$this->configuration[self::OPTION_MUTE_DEPRECATION_ERROR]) {
                    continue;
                }

                if ($tokens[$prevIndex]->equals('@')) {
                    continue;
                }

                $tokens->insertAt($startIndex, new Token('@'));

                continue;
            }

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

            if ($this->configuration[self::OPTION_NOISE_REMAINING_USAGES] && !\in_array($tokens[$functionIndex]->getContent(), $excludedFunctions, true)) {
                $tokens->clearAt($index);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $functionsAnalyzer = new FunctionsAnalyzer();
        $excludedFunctions = array_map(function ($function) {
            return strtolower($function);
        }, $this->configuration[self::OPTION_NOISE_REMAINING_USAGES_EXCLUDE]);

        for ($index = $tokens->count() - 1; $index >= 0; --$index) {
            $token = $tokens[$index];

            if ($this->configuration[self::OPTION_NOISE_REMAINING_USAGES] && $token->equals('@')) {
                $tokens->clearAt($index);

                continue;
            }

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

            $functionIndex = $index;
            $startIndex = $index;
            $prevIndex = $tokens->getPrevMeaningfulToken($index);
            if ($tokens[$prevIndex]->isGivenKind(T_NS_SEPARATOR)) {
                $startIndex = $prevIndex;
                $prevIndex = $tokens->getPrevMeaningfulToken($startIndex);
            }

            $index = $prevIndex;

            if ($this->isDeprecationErrorCall($tokens, $functionIndex)) {
                if (!$this->configuration[self::OPTION_MUTE_DEPRECATION_ERROR]) {
                    continue;
                }

                if ($tokens[$prevIndex]->equals('@')) {
                    continue;
                }

                $tokens->insertAt($startIndex, new Token('@'));

                continue;
            }

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

            if ($this->configuration[self::OPTION_NOISE_REMAINING_USAGES] && !\in_array($tokens[$functionIndex]->getContent(), $excludedFunctions, true)) {
                $tokens->clearAt($index);
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ functionsAnalyzer = new FunctionsAnalyzer ( ) ; $ excludedFunctions = array_map ( function ( $ function ) { return strtolower ( $ function ) ; } , $ this -> configuration [ self :: OPTION_NOISE_REMAINING_USAGES_EXCLUDE ] ) ; for ( $ index = $ tokens -> count ( ) - 1 ; $ index >= 0 ; -- $ index ) { $ token = $ tokens [ $ index ] ; if ( $ this -> configuration [ self :: OPTION_NOISE_REMAINING_USAGES ] && $ token -> equals ( '@' ) ) { $ tokens -> clearAt ( $ index ) ; continue ; } if ( ! $ functionsAnalyzer -> isGlobalFunctionCall ( $ tokens , $ index ) ) { continue ; } $ functionIndex = $ index ; $ startIndex = $ index ; $ prevIndex = $ tokens -> getPrevMeaningfulToken ( $ index ) ; if ( $ tokens [ $ prevIndex ] -> isGivenKind ( T_NS_SEPARATOR ) ) { $ startIndex = $ prevIndex ; $ prevIndex = $ tokens -> getPrevMeaningfulToken ( $ startIndex ) ; } $ index = $ prevIndex ; if ( $ this -> isDeprecationErrorCall ( $ tokens , $ functionIndex ) ) { if ( ! $ this -> configuration [ self :: OPTION_MUTE_DEPRECATION_ERROR ] ) { continue ; } if ( $ tokens [ $ prevIndex ] -> equals ( '@' ) ) { continue ; } $ tokens -> insertAt ( $ startIndex , new Token ( '@' ) ) ; continue ; } if ( ! $ tokens [ $ prevIndex ] -> equals ( '@' ) ) { continue ; } if ( $ this -> configuration [ self :: OPTION_NOISE_REMAINING_USAGES ] && ! \ in_array ( $ tokens [ $ functionIndex ] -> getContent ( ) , $ excludedFunctions , true ) ) { $ tokens -> clearAt ( $ index ) ; } } }
{@inheritdoc}
{