mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Parse template tag for generics (#21)
* Parse template tag for generics * Fixed templatetag docblock * Fixed PHP 7 issue * Fixed PHP 7.2 issue * Fixed another 7.2 issue
This commit is contained in:
@@ -15,6 +15,7 @@ namespace Barryvdh\Reflection;
|
||||
use Barryvdh\Reflection\DocBlock\Tag;
|
||||
use Barryvdh\Reflection\DocBlock\Context;
|
||||
use Barryvdh\Reflection\DocBlock\Location;
|
||||
use Barryvdh\Reflection\DocBlock\Tag\TemplateTag;
|
||||
|
||||
/**
|
||||
* Parses the DocBlock for any structure.
|
||||
@@ -40,6 +41,9 @@ class DocBlock implements \Reflector
|
||||
*/
|
||||
protected $tags = array();
|
||||
|
||||
/** @var string[] An array containing all the generics in this docblock. */
|
||||
protected $generics = array();
|
||||
|
||||
/** @var Context Information about the context of this DocBlock. */
|
||||
protected $context = null;
|
||||
|
||||
@@ -238,7 +242,11 @@ class DocBlock implements \Reflector
|
||||
|
||||
// create proper Tag objects
|
||||
foreach ($result as $key => $tag_line) {
|
||||
$result[$key] = Tag::createInstance(trim($tag_line), $this);
|
||||
$tag = Tag::createInstance(trim($tag_line), $this);
|
||||
if ($tag instanceof TemplateTag) {
|
||||
$this->generics[] = $tag->getTemplateName();
|
||||
}
|
||||
$result[$key] = $tag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +465,16 @@ class DocBlock implements \Reflector
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the generics for this DocBlock.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getGenerics()
|
||||
{
|
||||
return $this->generics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a string representation of this object.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user