mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Rename Other tag class to Generic and write test
This commit is contained in:
committed by
Mike van Riel
parent
4b4fc8fdf6
commit
0c63d0ae5b
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Other;
|
||||
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
|
||||
use phpDocumentor\Reflection\FqsenResolver;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
|
||||
@@ -85,7 +85,7 @@ final class TagFactory
|
||||
}
|
||||
list($tagName, $tagBody) = $this->extractTagParts($tagLine);
|
||||
|
||||
$handler = Other::class;
|
||||
$handler = Generic::class;
|
||||
if (isset($this->tagHandlerMappings[$tagName])) {
|
||||
$handler = $this->tagHandlerMappings[$tagName];
|
||||
} elseif ($this->isAnnotation($tagName)) {
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\TagFactory;
|
||||
use phpDocumentor\Reflection\Types\Context;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Parses a tag definition for a DocBlock.
|
||||
*/
|
||||
class Other extends BaseTag
|
||||
class Generic extends BaseTag
|
||||
{
|
||||
/**
|
||||
* Parses a tag and populates the member variables.
|
||||
@@ -37,14 +37,26 @@ class Other extends BaseTag
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new tag that represents any unknown tag type.
|
||||
*
|
||||
* @param string $body
|
||||
* @param string $name
|
||||
* @param DescriptionFactory $descriptionFactory
|
||||
* @param Context $context
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create(
|
||||
$body,
|
||||
$name = '',
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
Context $context = null
|
||||
)
|
||||
{
|
||||
$description = $descriptionFactory ? $descriptionFactory->create($body, $context) : null;
|
||||
) {
|
||||
Assert::string($body);
|
||||
Assert::stringNotEmpty($name);
|
||||
|
||||
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
|
||||
|
||||
return new static($name, $description);
|
||||
}
|
||||
@@ -56,7 +68,7 @@ class Other extends BaseTag
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "@{$this->getName()} {$this->description->render()}";
|
||||
return $this->getName() . ($this->description ? ' ' . $this->description->render() : '');
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user