From ed9a305e8788cc365524d1b6fa38063d8892a3cd Mon Sep 17 00:00:00 2001
From: Dave M <info@mcnd.ca>
Date: Tue, 20 Oct 2020 19:35:52 +0000
Subject: [PATCH] - Removed throw on unknown tags

---
 src/ObjectResolver.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/ObjectResolver.php b/src/ObjectResolver.php
index 1e7cfe6..e7b5f6a 100644
--- a/src/ObjectResolver.php
+++ b/src/ObjectResolver.php
@@ -34,7 +34,7 @@ class ObjectResolver {
     public function getAnnotationFromClassname(string $className) : ? object
     {
         if ( $name = $this->uses[$className] ?? false) {
-            foreach($this->class['tags'] as $item) {
+            foreach(array_reverse($this->class['tags']) as $item) {
                 if ( $item['tag'] === $name ) {
                     return $this->instanciateAnnotationObject($item);
                 }
@@ -100,13 +100,14 @@ class ObjectResolver {
 
         return $list;
     }
-
+    
     public function instanciateAnnotationObject(array $tagDefinition) : Annotation
     {
         $arguments = $this->extractArguments($tagDefinition['arguments']);
 
         if ( false === $class = array_search($tagDefinition['tag'], $this->uses) ) {
-            throw new \InvalidArgumentException("Annotation class `{$tagDefinition['tag']}` was not found within {$this->objectClass} uses statement (or it's children / traits)");
+            return new class() implements Annotation {};
+            # throw new \InvalidArgumentException("Annotation class `{$tagDefinition['tag']}` was not found within {$this->objectClass} uses statement (or it's children / traits)");
         }
 
         $obj = new $class(... $arguments['constructor']);