private function moveReturnAnnotations($content)
{
$doc = new DocBlock($content);
$returns = $doc->getAnnotationsOfType('return');
// nothing to do if there are no return annotations
if (empty($returns)) {
return $content;
}
$others = $doc->getAnnotationsOfType(array('param', 'throws'));
// nothing to do if there are no other annotations
if (empty($others)) {
return $content;
}
// get the index of the first line of the first return annotation
$start = $returns[0]->getStart();
$line = $doc->getLine($start);
// move stuff about if required
foreach (array_reverse($others) as $other) {
if ($other->getEnd() > $start) {
// we're doing this to maintain the original line indexes
$line->setContent($other->getContent() . $line->getContent());
$other->remove();
}
}
return $doc->getContent();
}