code: protected function cleanDocComment($doc)
      {
          $lines = explode("\n", $doc);
          $n = \count($lines);
          for ($i = 0; $i < $n; $i++) {
              $lines[$i] = rtrim($lines[$i]);
              if (trim($lines[$i]) == '*' && trim($lines[$i + 1]) == '*') {
                  unset($lines[$i]);
              }
          }
  
          return implode("\n", $lines);
      }
docs: remove multi empty lines and trim trailing whitespace.
  
  @param $doc
  @return string