File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 2727use Ubiquity \attributes \items \Transient ;
2828use Ubiquity \attributes \items \Validator ;
2929use Ubiquity \attributes \items \Yuml ;
30+ use Ubiquity \creator \HasUsesTrait ;
3031
3132class AttributesEngine implements AnnotationsEngineInterface {
3233
@@ -95,10 +96,12 @@ public function registerAnnotations(array $nameClasses): void {
9596 \array_merge (self ::$ registry , $ nameClasses );
9697 }
9798
98- public function getAnnotation (object $ container , string $ key , array $ parameters = []): ?object {
99+ public function getAnnotation (? object $ container , string $ key , array $ parameters = []): ?object {
99100 if (isset (self ::$ registry [$ key ])) {
100101 $ classname = self ::$ registry [$ key ];
101- $ container ->addUse ($ classname );
102+ if (isset ($ container ) && ($ container instanceof HasUsesTrait)) {
103+ $ container ->addUse ($ classname );
104+ }
102105 $ reflect = new \ReflectionClass ($ classname );
103106 return $ reflect ->newInstanceArgs ($ parameters );
104107 }
You can’t perform that action at this time.
0 commit comments