PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer::insertSequence PHP Method

insertSequence() private method

private insertSequence ( Tokens $tokens )
$tokens PhpCsFixer\Tokenizer\Tokens
    private function insertSequence(Tokens $tokens)
    {
        $sequence = $this->getDeclareStrictTypeSequence();
        $sequence[] = new Token(';');
        $endIndex = count($sequence);
        $tokens->insertAt(1, $sequence);
        // start index of the sequence is always 1 here, 0 is always open tag
        // transform "<?php\n" to "<?php " if needed
        if (false !== strpos($tokens[0]->getContent(), "\n")) {
            $tokens[0]->setContent(trim($tokens[0]->getContent()) . ' ');
        }
        if ($endIndex === count($tokens) - 1) {
            return;
            // no more tokens afters sequence, single_blank_line_at_eof might add a line
        }
        $lineEnding = $this->whitespacesConfig->getLineEnding();
        if (!$tokens[1 + $endIndex]->isWhitespace()) {
            $tokens->insertAt(1 + $endIndex, new Token(array(T_WHITESPACE, $lineEnding)));
            return;
        }
        $content = $tokens[1 + $endIndex]->getContent();
        if (false !== strpos($content, "\n")) {
            return;
        }
        $tokens[1 + $endIndex]->setContent($lineEnding . ltrim($content));
    }