Add example and functional test for reconstituting a DocBlock

This commit is contained in:
Mike van Riel
2015-06-27 16:47:47 +02:00
parent 1b5279c777
commit a6ffa93e28
4 changed files with 62 additions and 9 deletions
+4 -6
View File
@@ -53,12 +53,10 @@ class See extends BaseTag
Assert::string($body);
Assert::allNotNull([$resolver, $descriptionFactory]);
$parts = preg_split('/\s+/Su', $body, 2);
$parts = preg_split('/\s+/Su', $body, 2);
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
return new static(
$resolver->resolve($parts[0], $context),
$descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context)
);
return new static($resolver->resolve($parts[0], $context), $description);
}
/**
@@ -78,6 +76,6 @@ class See extends BaseTag
*/
public function __toString()
{
return $this->refers . ' ' . $this->description->render();
return $this->refers . ($this->description ? ' ' . $this->description->render() : '');
}
}