/** * @dataProvider provideComparatorCases */ public function testComparatorTogether($first, $second, $expected) { $tag1 = new Tag(new Line('* @' . $first)); $tag2 = new Tag(new Line('* @' . $second)); $this->assertSame($expected, TagComparator::shouldBeTogether($tag1, $tag2)); }
/** * Make sure the annotations are correctly separated. * * @param DocBlock $doc * * @return string */ private function fixAnnotations(DocBlock $doc) { foreach ($doc->getAnnotations() as $index => $annotation) { $next = $doc->getAnnotation($index + 1); if (null === $next) { break; } if (true === $next->getTag()->valid()) { if (TagComparator::shouldBeTogether($annotation->getTag(), $next->getTag())) { $this->ensureAreTogether($doc, $annotation, $next); } else { $this->ensureAreSeparate($doc, $annotation, $next); } } } return $doc->getContent(); }