mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Add test for DocBlock class
This commit is contained in:
committed by
Mike van Riel
parent
b87a111eb2
commit
5749b814fb
+49
-56
@@ -13,8 +13,7 @@
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\DocBlock\Context;
|
||||
use phpDocumentor\Reflection\DocBlock\Location;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
|
||||
final class DocBlock
|
||||
{
|
||||
@@ -40,12 +39,6 @@ final class DocBlock
|
||||
private $isTemplateEnd = false;
|
||||
|
||||
/**
|
||||
* Parses the given docblock and populates the member fields.
|
||||
*
|
||||
* The constructor may also receive namespace information such as the
|
||||
* current namespace and aliases. This information is used by some tags
|
||||
* (e.g. return, param, etc.) to turn a relative Type into a FQCN.
|
||||
*
|
||||
* @param string $summary
|
||||
* @param DocBlock\Description $description
|
||||
* @param DocBlock\Tag[] $tags
|
||||
@@ -77,6 +70,42 @@ final class DocBlock
|
||||
$this->isTemplateStart = $isTemplateStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DocBlock\Description
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current context.
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location.
|
||||
*
|
||||
* @return Location
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this DocBlock is the start of a Template section.
|
||||
*
|
||||
@@ -115,54 +144,6 @@ final class DocBlock
|
||||
return $this->isTemplateEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current context.
|
||||
*
|
||||
* @return Context
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current location.
|
||||
*
|
||||
* @return Location
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DocBlock\Description
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tag to this DocBlock.
|
||||
*
|
||||
* @param Tag $tag The tag to add.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addTag(Tag $tag)
|
||||
{
|
||||
$this->tags[] = $tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tags for this DocBlock.
|
||||
*
|
||||
@@ -215,4 +196,16 @@ final class DocBlock
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tag to this DocBlock.
|
||||
*
|
||||
* @param Tag $tag The tag to add.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addTag(Tag $tag)
|
||||
{
|
||||
$this->tags[] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
|
||||
/**
|
||||
* @param $docblock
|
||||
* @param DocBlock\Context $context
|
||||
* @param DocBlock\Location $location
|
||||
* @param Types\Context $context
|
||||
* @param Location $location
|
||||
*
|
||||
* @return DocBlock
|
||||
*/
|
||||
public function create($docblock, DocBlock\Context $context = null, DocBlock\Location $location = null)
|
||||
public function create($docblock, Types\Context $context = null, Location $location = null)
|
||||
{
|
||||
if (is_object($docblock)) {
|
||||
if (!method_exists($docblock, 'getDocComment')) {
|
||||
|
||||
@@ -14,10 +14,10 @@ interface DocBlockFactoryInterface
|
||||
|
||||
/**
|
||||
* @param string $docblock
|
||||
* @param DocBlock\Context $context
|
||||
* @param DocBlock\Location $location
|
||||
* @param Types\Context $context
|
||||
* @param Location $location
|
||||
*
|
||||
* @return DocBlock
|
||||
*/
|
||||
public function create($docblock, DocBlock\Context $context = null, DocBlock\Location $location = null);
|
||||
public function create($docblock, Types\Context $context = null, Location $location = null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user