src/Fixer/Basic/EncodingFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $content = $tokens[0]->getContent();

        if (0 === strncmp($content, $this->BOM, 3)) {
            $newContent = substr($content, 3);

            if (false === $newContent) {
                $newContent = ''; // substr returns false rather than an empty string when starting at the end
            }

            if ('' === $newContent) {
                $tokens->clearAt(0);
            } else {
                $tokens[0] = new Token([$tokens[0]->getId(), $newContent]);
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        $content = $tokens[0]->getContent();

        if (0 === strncmp($content, $this->BOM, 3)) {
            $newContent = substr($content, 3);

            if (false === $newContent) {
                $newContent = ''; // substr returns false rather than an empty string when starting at the end
            }

            if ('' === $newContent) {
                $tokens->clearAt(0);
            } else {
                $tokens[0] = new Token([$tokens[0]->getId(), $newContent]);
            }
        }
    }
{@inheritdoc}