- Removed throw on unknown tags
This commit is contained in:
parent
9f8bc3c0d5
commit
ed9a305e87
|
@ -34,7 +34,7 @@ class ObjectResolver {
|
||||||
public function getAnnotationFromClassname(string $className) : ? object
|
public function getAnnotationFromClassname(string $className) : ? object
|
||||||
{
|
{
|
||||||
if ( $name = $this->uses[$className] ?? false) {
|
if ( $name = $this->uses[$className] ?? false) {
|
||||||
foreach($this->class['tags'] as $item) {
|
foreach(array_reverse($this->class['tags']) as $item) {
|
||||||
if ( $item['tag'] === $name ) {
|
if ( $item['tag'] === $name ) {
|
||||||
return $this->instanciateAnnotationObject($item);
|
return $this->instanciateAnnotationObject($item);
|
||||||
}
|
}
|
||||||
|
@ -100,13 +100,14 @@ class ObjectResolver {
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instanciateAnnotationObject(array $tagDefinition) : Annotation
|
public function instanciateAnnotationObject(array $tagDefinition) : Annotation
|
||||||
{
|
{
|
||||||
$arguments = $this->extractArguments($tagDefinition['arguments']);
|
$arguments = $this->extractArguments($tagDefinition['arguments']);
|
||||||
|
|
||||||
if ( false === $class = array_search($tagDefinition['tag'], $this->uses) ) {
|
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']);
|
$obj = new $class(... $arguments['constructor']);
|
||||||
|
|
Loading…
Reference in New Issue