/** * Remove return void or return null annotations.. * * @param DocBlock $doc * @param Annotation $annotation */ private function fixAnnotation(DocBlock $doc, Annotation $annotation) { if (1 === preg_match('/@return\\s+(void|null)(?!\\|)/', $doc->getLine($annotation->getStart())->getContent())) { $annotation->remove(); } }
/** * Force the given annotations to have one empty line between each other. * * @param DocBlock $doc * @param Annotation $first * @param Annotation $second */ private function ensureAreSeparate(DocBlock $doc, Annotation $first, Annotation $second) { $pos = $first->getEnd(); $final = $second->getStart() - 1; // check if we need to add a line, or need to remove one or more lines if ($pos === $final) { $doc->getLine($pos)->addBlank(); return; } for ($pos = $pos + 1; $pos < $final; ++$pos) { $doc->getLine($pos)->remove(); } }