@@ -32,8 +32,6 @@ class AttributesEngine implements AnnotationsEngineInterface {
3232
3333 protected static array $ registry ;
3434
35- protected array $ uses ;
36-
3735 protected function attributesNewInstances (array $ attributes ): array {
3836 $ result = [];
3937 foreach ($ attributes as $ attribute ) {
@@ -87,7 +85,6 @@ public function start(string $cacheDirectory): void {
8785 'autowired ' => Autowired::class,
8886 'injected ' => Injected::class
8987 ];
90- $ this ->uses = [];
9188 }
9289
9390 public function getAnnotationByKey (?string $ key = null ): ?string {
@@ -98,10 +95,10 @@ public function registerAnnotations(array $nameClasses): void {
9895 \array_merge (self ::$ registry , $ nameClasses );
9996 }
10097
101- public function getAnnotation (string $ key , array $ parameters = []): ?object {
98+ public function getAnnotation (object $ container , string $ key , array $ parameters = []): ?object {
10299 if (isset (self ::$ registry [$ key ])) {
103100 $ classname = self ::$ registry [$ key ];
104- $ this -> uses [ $ classname] = true ;
101+ $ container -> addUse ( $ classname) ;
105102 $ reflect = new \ReflectionClass ($ classname );
106103 return $ reflect ->newInstanceArgs ($ parameters );
107104 }
@@ -141,9 +138,5 @@ public function is(string $key, object $annotation): bool {
141138 }
142139 return false ;
143140 }
144-
145- public function getUses (): array {
146- return \array_keys ($ this ->uses );
147- }
148141}
149142
0 commit comments