src/AbstractFopenFlagFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $argumentsAnalyzer = new ArgumentsAnalyzer();

        $index = 0;
        $end = $tokens->count() - 1;
        while (true) {
            $candidate = $this->find('fopen', $tokens, $index, $end);

            if (null === $candidate) {
                break;
            }

            $index = $candidate[1]; // proceed to '(' of `fopen`

            // fetch arguments
            $arguments = $argumentsAnalyzer->getArguments(
                $tokens,
                $index,
                $candidate[2]
            );

            $argumentsCount = \count($arguments); // argument count sanity check

            if ($argumentsCount < 2 || $argumentsCount > 4) {
                continue;
            }

            $argumentStartIndex = array_keys($arguments)[1]; // get second argument index

            $this->fixFopenFlagToken(
                $tokens,
                $argumentStartIndex,
                $arguments[$argumentStartIndex]
            );
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $argumentsAnalyzer = new ArgumentsAnalyzer();

        $index = 0;
        $end = $tokens->count() - 1;
        while (true) {
            $candidate = $this->find('fopen', $tokens, $index, $end);

            if (null === $candidate) {
                break;
            }

            $index = $candidate[1]; // proceed to '(' of `fopen`

            // fetch arguments
            $arguments = $argumentsAnalyzer->getArguments(
                $tokens,
                $index,
                $candidate[2]
            );

            $argumentsCount = \count($arguments); // argument count sanity check

            if ($argumentsCount < 2 || $argumentsCount > 4) {
                continue;
            }

            $argumentStartIndex = array_keys($arguments)[1]; // get second argument index

            $this->fixFopenFlagToken(
                $tokens,
                $argumentStartIndex,
                $arguments[$argumentStartIndex]
            );
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { $ argumentsAnalyzer = new ArgumentsAnalyzer ( ) ; $ index = 0 ; $ end = $ tokens -> count ( ) - 1 ; while ( true ) { $ candidate = $ this -> find ( 'fopen' , $ tokens , $ index , $ end ) ; if ( null === $ candidate ) { break ; } $ index = $ candidate [ 1 ] ; // proceed to '(' of `fopen` // fetch arguments $ arguments = $ argumentsAnalyzer -> getArguments ( $ tokens , $ index , $ candidate [ 2 ] ) ; $ argumentsCount = \ count ( $ arguments ) ; // argument count sanity check if ( $ argumentsCount < 2 || $ argumentsCount > 4 ) { continue ; } $ argumentStartIndex = array_keys ( $ arguments ) [ 1 ] ; // get second argument index $ this -> fixFopenFlagToken ( $ tokens , $ argumentStartIndex , $ arguments [ $ argumentStartIndex ] ) ; } }
{@inheritdoc}
{