- Fixed Notes bugs with Union Types Reflection

This commit is contained in:
Dave Mc Nicoll 2024-04-24 11:24:27 -04:00
parent 340235e2f8
commit 996c8fa14a
1 changed files with 15 additions and 10 deletions

View File

@ -65,13 +65,13 @@ class ObjectReflection {
if ( $traits = $this->classReflection->getTraits() ) {
foreach($traits as $key => $value) {
$traitTags = array_merge_recursive($traitTags ?? [], static::fromClass($key)->gatherClass(true));
$traitTags = static::fromClass($key)->gatherClass(true);
}
}
if ( $interfaces = $this->classReflection->getInterfaces() ) {
foreach($interfaces as $key => $value) {
$interfaceTags = array_merge_recursive($interfaceTags ?? [], static::fromClass($key)->gatherClass(true));
$interfaceTags = static::fromClass($key)->gatherClass(true);
}
}
@ -81,11 +81,11 @@ class ObjectReflection {
}
return array_merge_recursive($class ?? [], $traitTags ?? [], $interfaceTags ?? [], [
'tags' => $this->annotationReader->getClass($this->classReflection)
] + ( ! $full ? [] : [
'traits' => array_map($itemName, $traits),
'interfaces' => array_map($itemName, $interfaces),
] ));
'tags' => $this->annotationReader->getClass($this->classReflection)
] + ( ! $full ? [] : [
'traits' => array_map($itemName, $traits),
'interfaces' => array_map($itemName, $interfaces),
] ));
}
public function gatherProperties(bool $full = true, int $filter =
@ -114,10 +114,15 @@ class ObjectReflection {
$current['value'] = $defaultValues[ $current['name'] ];
}
if ( $property->hasType() ) {
$current['type'] = $property->getType()->getName();
$current['builtin'] = $property->getType()->isBuiltIn();
$current['nullable'] = $property->getType()->allowsNull();
$type = $property->getType();
if (! $type instanceof \ReflectionUnionType ) {
$current['type'] = $type->getName();
$current['builtin'] = $type->isBuiltIn();
$current['nullable'] = $type->allowsNull();
}
}
$current['tags'] = $this->annotationReader->getProperty($property);