mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Add assertions to DocBlock
This commit is contained in:
committed by
Mike van Riel
parent
57c78b2c8b
commit
ab3ebf467c
@@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class DocBlock
|
||||
{
|
||||
@@ -57,6 +58,10 @@ final class DocBlock
|
||||
$isTemplateEnd = false
|
||||
)
|
||||
{
|
||||
Assert::string($summary);
|
||||
Assert::boolean($isTemplateStart);
|
||||
Assert::boolean($isTemplateEnd);
|
||||
|
||||
$this->summary = $summary;
|
||||
$this->description = $description ?: new DocBlock\Description('');
|
||||
foreach ($tags as $tag) {
|
||||
@@ -164,6 +169,8 @@ final class DocBlock
|
||||
*/
|
||||
public function getTagsByName($name)
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
$result = array();
|
||||
|
||||
/** @var Tag $tag */
|
||||
@@ -187,6 +194,8 @@ final class DocBlock
|
||||
*/
|
||||
public function hasTag($name)
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() == $name) {
|
||||
|
||||
Reference in New Issue
Block a user