- Fixed missing tags from traits

This commit is contained in:
Dave M. 2023-11-17 21:59:29 -05:00
parent 5f00c2b603
commit 0fcff83eac
2 changed files with 10 additions and 10 deletions

View File

@ -34,12 +34,12 @@ class AnnotationReader
return $this->parseDocComment($method); return $this->parseDocComment($method);
} }
protected function parseDocComment(Reflector $reflect) protected function parseDocComment(\Reflector $reflect)
{ {
$tags = []; $tags = [];
if ( $reflect->getAttributes() ) { if ( $attributes = $reflect->getAttributes() ) {
foreach($reflect->getAttributes() as $attr) { foreach($attributes as $attr) {
try { try {
$tags[] = [ $tags[] = [
'tag' => substr(strrchr($attr->getName(), "\\"), 1), 'tag' => substr(strrchr($attr->getName(), "\\"), 1),

View File

@ -65,13 +65,13 @@ class ObjectReflection {
if ( $traits = $this->classReflection->getTraits() ) { if ( $traits = $this->classReflection->getTraits() ) {
foreach($traits as $key => $value) { foreach($traits as $key => $value) {
$traitTags = static::fromClass($key)->gatherClass(true); $traitTags = array_merge_recursive($traitTags ?? [], static::fromClass($key)->gatherClass(true));
} }
} }
if ( $interfaces = $this->classReflection->getInterfaces() ) { if ( $interfaces = $this->classReflection->getInterfaces() ) {
foreach($interfaces as $key => $value) { foreach($interfaces as $key => $value) {
$interfaceTags = static::fromClass($key)->gatherClass(true); $interfaceTags = array_merge_recursive($interfaceTags ?? [], static::fromClass($key)->gatherClass(true));
} }
} }
@ -81,11 +81,11 @@ class ObjectReflection {
} }
return array_merge_recursive($class ?? [], $traitTags ?? [], $interfaceTags ?? [], [ return array_merge_recursive($class ?? [], $traitTags ?? [], $interfaceTags ?? [], [
'tags' => $this->annotationReader->getClass($this->classReflection) 'tags' => $this->annotationReader->getClass($this->classReflection)
] + ( ! $full ? [] : [ ] + ( ! $full ? [] : [
'traits' => array_map($itemName, $traits), 'traits' => array_map($itemName, $traits),
'interfaces' => array_map($itemName, $interfaces), 'interfaces' => array_map($itemName, $interfaces),
] )); ] ));
} }
public function gatherProperties(bool $full = true, int $filter = public function gatherProperties(bool $full = true, int $filter =