From d92bb527daa9d52f892b8f4c4b089c80b3f547cb Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Thu, 26 Jan 2023 18:49:30 +0000 Subject: [PATCH] - Attached a new exc eption message whenever an attribute is missing --- src/AnnotationReader.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/AnnotationReader.php b/src/AnnotationReader.php index 285225e..c1fd360 100644 --- a/src/AnnotationReader.php +++ b/src/AnnotationReader.php @@ -40,11 +40,16 @@ class AnnotationReader if ( $reflect->getAttributes() ) { foreach($reflect->getAttributes() as $attr) { - $tags[] = [ - 'tag' => substr(strrchr($attr->getName(), "\\"), 1), - 'arguments' => $attr->getArguments(), - 'object' => $attr->newInstance(), - ]; + try { + $tags[] = [ + 'tag' => substr(strrchr($attr->getName(), "\\"), 1), + 'arguments' => $attr->getArguments(), + 'object' => $attr->newInstance(), + ]; + } + catch(\Throwable $e) { + throw new \Exception(sprintf("%s for %s in file '%s'", $e->getMessage(), $reflect, $this->class)); + } } } else {