src/Fixer/Strict/DeclareStrictTypesFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        // check if the declaration is already done
        $searchIndex = $tokens->getNextMeaningfulToken(0);
        if (null === $searchIndex) {
            $this->insertSequence($tokens); // declaration not found, insert one

            return;
        }

        $sequence = $this->getDeclareStrictTypeSequence();
        $sequenceLocation = $tokens->findSequence($sequence, $searchIndex, null, false);
        if (null === $sequenceLocation) {
            $this->insertSequence($tokens); // declaration not found, insert one

            return;
        }

        $this->fixStrictTypesCasing($tokens, $sequenceLocation);
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        // check if the declaration is already done
        $searchIndex = $tokens->getNextMeaningfulToken(0);
        if (null === $searchIndex) {
            $this->insertSequence($tokens); // declaration not found, insert one

            return;
        }

        $sequence = $this->getDeclareStrictTypeSequence();
        $sequenceLocation = $tokens->findSequence($sequence, $searchIndex, null, false);
        if (null === $sequenceLocation) {
            $this->insertSequence($tokens); // declaration not found, insert one

            return;
        }

        $this->fixStrictTypesCasing($tokens, $sequenceLocation);
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { // check if the declaration is already done $ searchIndex = $ tokens -> getNextMeaningfulToken ( 0 ) ; if ( null === $ searchIndex ) { $ this -> insertSequence ( $ tokens ) ; // declaration not found, insert one return ; } $ sequence = $ this -> getDeclareStrictTypeSequence ( ) ; $ sequenceLocation = $ tokens -> findSequence ( $ sequence , $ searchIndex , null , false ) ; if ( null === $ sequenceLocation ) { $ this -> insertSequence ( $ tokens ) ; // declaration not found, insert one return ; } $ this -> fixStrictTypesCasing ( $ tokens , $ sequenceLocation ) ; }
{@inheritdoc}
{