diff --git a/src/AnnotationReader.php b/src/AnnotationReader.php index 5d30232..5fdb920 100644 --- a/src/AnnotationReader.php +++ b/src/AnnotationReader.php @@ -99,6 +99,8 @@ class AnnotationReader case $reflect instanceof ReflectionClass : return $reflect->name; } + + return "#UNKNOWN#"; } protected function getObjectNamespace(Reflector $reflect) : string diff --git a/src/Breadcrumb/Breadcrumb.php b/src/Breadcrumb/Breadcrumb.php index d2011d5..ceb27fb 100644 --- a/src/Breadcrumb/Breadcrumb.php +++ b/src/Breadcrumb/Breadcrumb.php @@ -10,6 +10,8 @@ use RuntimeException, DirectoryIterator, Generator; class Breadcrumb extends RouteFetcher { + public bool $ignoreSoleRoute = true; + public function getRouteTree(\Notes\Route\Attribute\Method\Route $route) : array { $tree = []; @@ -36,7 +38,11 @@ class Breadcrumb extends RouteFetcher { else { $route = null; } - }; + } + + if ($this->ignoreSoleRoute && count($tree) === 1) { + return []; + } return array_reverse($tree); } diff --git a/src/ObjectReflection.php b/src/ObjectReflection.php index 187d470..56d972b 100644 --- a/src/ObjectReflection.php +++ b/src/ObjectReflection.php @@ -25,8 +25,8 @@ class ObjectReflection { $this->cache = $cache; #if ( ! $this->cache || ! $this->cache->has($class) ) { - $this->classReflection = $class instanceof ReflectionClass ? $class : new ReflectionClass($class); - # } + $this->classReflection = $class instanceof ReflectionClass ? $class : new ReflectionClass($class); + # } } public static function fromClass(ReflectionClass|string $class, ? CacheInterface $cache = null) : self @@ -53,11 +53,11 @@ class ObjectReflection { traits: array_map(fn($trait) => static::fromClass($trait)->reflectClass(), array_keys($this->classReflection->getTraits())), ); } - + public function reflectProperties(int $filter = - ReflectionProperty::IS_PUBLIC | - ReflectionProperty::IS_PROTECTED | - ReflectionProperty::IS_PRIVATE + ReflectionProperty::IS_PUBLIC | + ReflectionProperty::IS_PROTECTED | + ReflectionProperty::IS_PRIVATE ) : array { $defaultValues = $this->classReflection->getDefaultProperties(); @@ -87,11 +87,11 @@ class ObjectReflection { } public function reflectMethods(int $filter = - ReflectionMethod::IS_PUBLIC | - ReflectionMethod::IS_PROTECTED | - ReflectionMethod::IS_PRIVATE | - ReflectionMethod::IS_STATIC | - ReflectionMethod::IS_FINAL + ReflectionMethod::IS_PUBLIC | + ReflectionMethod::IS_PROTECTED | + ReflectionMethod::IS_PRIVATE | + ReflectionMethod::IS_STATIC | + ReflectionMethod::IS_FINAL ) : array { $list = [];