public function writePhpDoc()
    {
        $fileContents = file_get_contents($this->getFileName());
        $existingDoc = $this->getDocComment();

        $serializer = new DocBlock\Serializer();
        $newDoc = $serializer->getDocComment($this->classDocBlock);

        // PhpDocumentor inserts a space between @SuppressWarnings and its following bracket,
        // which prevents PHP Mess Detector from picking up on the comment
        $newDoc = str_replace('@SuppressWarnings (', '@SuppressWarnings(', $newDoc);

        // Remove whitespace from end of all lines in doc block
        $newDoc = preg_replace('/\s+$/m', '', $newDoc);

        if ($existingDoc) {
            $fileContents = StringTools::replaceFirst($existingDoc, $newDoc, $fileContents);
        } else {
            $fileContents = preg_replace('/^(class\s+' . $this->getShortName() . ')/m', str_replace('$', '\$', $newDoc) . "\n\$1", $fileContents, 1);
        }

        file_put_contents($this->getFileName(), $fileContents);
    }